Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
luxcem authored and Arnaud Fabre committed Apr 30, 2015
0 parents commit 7a0fd12
Show file tree
Hide file tree
Showing 9 changed files with 179 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.sqlite3
*.sqlite
*.pyc
10 changes: 10 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "toutatis.settings")

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)
1 change: 1 addition & 0 deletions representatives
1 change: 1 addition & 0 deletions representatives_votes
Empty file added toutatis/__init__.py
Empty file.
108 changes: 108 additions & 0 deletions toutatis/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
"""
Django settings for toutatis project.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'jvft^$@-qfyhbrm@zkmaak$w-7b73dx$^b378@ol%_xuvw^xi='

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'parltrack_votes',
'parltrack_meps',
'representatives',
'parltrack_meps_to_representatives',
'representatives_votes',
'toutatis'
)

MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
)

ROOT_URLCONF = 'toutatis.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'toutatis.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}


# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/

STATIC_URL = '/static/'
29 changes: 29 additions & 0 deletions toutatis/templates/toutatis/home.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Toutatis - Home</title>
</head>
<body>
<h1 id="Toutatis">Toutatis</h1>
<p>Hello, Toutatis is a simple webapp that convert the Votes of the European Parliament data taken from <a href="https://parltrack.euwiki.org">parltrack</a> in the <a href="https://github.com/yohanboniface/django-representatives/blob/master/format.json">"representatives-votes" format</a>.</p>

<p>If you aren't interested in those data and/or aren't using a lib/application that is implementing the "representatives" format, this website won't have a lot of interest for you.</p>

<h2>API</h2>

<p>If you want more fingrain access to the dumps and their meta data, you can access all of the via a <a href="http://django-tastypie.readthedocs.org/en/latest/">tastypie</a> API.</p>

<p><b>Warning:</b> those data is quite big so expect some slowdown if you try to open them in your browser.</p>

<p>The API is accessible at this url: <code>http://{{ request.META.SERVER_NAME }}/api/exported_revision/?format=json</code></p>

<p>Sample usage: <code>curl http://{{ request.META.SERVER_NAME }}/api/exported_revision/?format=json | python -m json.tool</code></p>

<hr/>

<p>Toutatis is free software under the aGPLv3+. <a href="">Source code</a></p>

<p><small><i>Toutatis was a Celtic god worshipped in ancient Gaul and Britain.</i></small></p>
</body>
</html>
11 changes: 11 additions & 0 deletions toutatis/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import TemplateView

urlpatterns = [

url(r'^$', TemplateView.as_view(template_name="toutatis/home.html")),
# url(r'^blog/', include('blog.urls')),

url(r'^admin/', include(admin.site.urls)),
]
16 changes: 16 additions & 0 deletions toutatis/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for toutatis project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "toutatis.settings")

application = get_wsgi_application()

0 comments on commit 7a0fd12

Please sign in to comment.