Skip to content
Snippets Groups Projects
Unverified Commit d973dd48 authored by Marco Ciotola's avatar Marco Ciotola
Browse files

Upgrade Django to 1.9

parent a70a4be2
No related branches found
No related tags found
No related merge requests found
...@@ -2,18 +2,21 @@ ...@@ -2,18 +2,21 @@
Testing Helios Features Testing Helios Features
""" """
from helios.models import *
from helios_auth.models import *
import uuid import uuid
def generate_voters(election, num_voters = 1000, start_with = 1): from helios.models import Voter
# generate the user from helios_auth.models import User
for v_num in range(start_with, start_with + num_voters):
user = User(user_type='password', user_id='testuser%s' % v_num, name='Test User %s' % v_num)
user.put() def generate_voters(election, num_voters=1000, start_with=1):
voter = Voter(uuid=str(uuid.uuid1()), election = election, voter_type=user.user_type, voter_id = user.user_id) # generate the user
voter.put() for v_num in range(start_with, start_with + num_voters):
user = User(user_type='password', user_id='testuser%s' % v_num, name='Test User %s' % v_num)
user.save()
voter = Voter(uuid=str(uuid.uuid1()), election=election, voter_type=user.user_type, voter_id=user.user_id)
voter.save()
def delete_voters(election): def delete_voters(election):
for v in Voter.get_by_election(election): for v in Voter.get_by_election(election):
v.delete() v.delete()
\ No newline at end of file
Django==1.8.19 Django==1.9.13
anyjson==0.3.3 anyjson==0.3.3
celery==3.1.25 celery==3.1.25
django-celery==3.2.2 django-celery==3.2.2
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
set -e # Exit immediately if a command exits with a non-zero status. set -e # Exit immediately if a command exits with a non-zero status.
dropdb helios dropdb helios
createdb helios createdb helios
python manage.py syncdb python manage.py makemigrations
python manage.py migrate python manage.py migrate
echo "from helios_auth.models import User; User.objects.create(user_type='google',user_id='ben@adida.net', info={'name':'Ben Adida'})" | python manage.py shell echo "from helios_auth.models import User; User.objects.create(user_type='google',user_id='ben@adida.net', info={'name':'Ben Adida'})" | python manage.py shell
\ No newline at end of file
...@@ -47,7 +47,7 @@ if get_from_env('DATABASE_URL', None): ...@@ -47,7 +47,7 @@ if get_from_env('DATABASE_URL', None):
import dj_database_url import dj_database_url
DATABASES['default'] = dj_database_url.config() DATABASES['default'] = dj_database_url.config()
DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2' DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
DATABASES['default']['CONN_MAX_AGE'] = 600 DATABASES['default']['CONN_MAX_AGE'] = '600'
# require SSL # require SSL
DATABASES['default']['OPTIONS'] = {'sslmode': 'require'} DATABASES['default']['OPTIONS'] = {'sslmode': 'require'}
...@@ -93,7 +93,7 @@ SECRET_KEY = get_from_env('SECRET_KEY', 'replaceme') ...@@ -93,7 +93,7 @@ SECRET_KEY = get_from_env('SECRET_KEY', 'replaceme')
ALLOWED_HOSTS = get_from_env('ALLOWED_HOSTS', 'localhost').split(",") ALLOWED_HOSTS = get_from_env('ALLOWED_HOSTS', 'localhost').split(",")
# Secure Stuff # Secure Stuff
if (get_from_env('SSL', '0') == '1'): if get_from_env('SSL', '0') == '1':
SECURE_SSL_REDIRECT = True SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True SESSION_COOKIE_SECURE = True
...@@ -104,7 +104,7 @@ SESSION_COOKIE_HTTPONLY = True ...@@ -104,7 +104,7 @@ SESSION_COOKIE_HTTPONLY = True
# let's go with one year because that's the way to do it now # let's go with one year because that's the way to do it now
STS = False STS = False
if (get_from_env('HSTS', '0') == '1'): if get_from_env('HSTS', '0') == '1':
STS = True STS = True
# we're using our own custom middleware now # we're using our own custom middleware now
# SECURE_HSTS_SECONDS = 31536000 # SECURE_HSTS_SECONDS = 31536000
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment