Upgrade Django to 1.9
This commit is contained in:
parent
a70a4be2c0
commit
d973dd4885
|
@ -2,18 +2,21 @@
|
|||
Testing Helios Features
|
||||
"""
|
||||
|
||||
from helios.models import *
|
||||
from helios_auth.models import *
|
||||
import uuid
|
||||
|
||||
def generate_voters(election, num_voters = 1000, start_with = 1):
|
||||
# generate the 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()
|
||||
voter = Voter(uuid=str(uuid.uuid1()), election = election, voter_type=user.user_type, voter_id = user.user_id)
|
||||
voter.put()
|
||||
from helios.models import Voter
|
||||
from helios_auth.models import User
|
||||
|
||||
|
||||
def generate_voters(election, num_voters=1000, start_with=1):
|
||||
# generate the 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.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):
|
||||
for v in Voter.get_by_election(election):
|
||||
v.delete()
|
||||
for v in Voter.get_by_election(election):
|
||||
v.delete()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Django==1.8.19
|
||||
Django==1.9.13
|
||||
anyjson==0.3.3
|
||||
celery==3.1.25
|
||||
django-celery==3.2.2
|
||||
|
|
2
reset.sh
2
reset.sh
|
@ -2,6 +2,6 @@
|
|||
set -e # Exit immediately if a command exits with a non-zero status.
|
||||
dropdb helios
|
||||
createdb helios
|
||||
python manage.py syncdb
|
||||
python manage.py makemigrations
|
||||
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
|
|
@ -47,7 +47,7 @@ if get_from_env('DATABASE_URL', None):
|
|||
import dj_database_url
|
||||
DATABASES['default'] = dj_database_url.config()
|
||||
DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
|
||||
DATABASES['default']['CONN_MAX_AGE'] = 600
|
||||
DATABASES['default']['CONN_MAX_AGE'] = '600'
|
||||
|
||||
# require SSL
|
||||
DATABASES['default']['OPTIONS'] = {'sslmode': 'require'}
|
||||
|
@ -93,7 +93,7 @@ SECRET_KEY = get_from_env('SECRET_KEY', 'replaceme')
|
|||
ALLOWED_HOSTS = get_from_env('ALLOWED_HOSTS', 'localhost').split(",")
|
||||
|
||||
# Secure Stuff
|
||||
if (get_from_env('SSL', '0') == '1'):
|
||||
if get_from_env('SSL', '0') == '1':
|
||||
SECURE_SSL_REDIRECT = True
|
||||
SESSION_COOKIE_SECURE = True
|
||||
|
||||
|
@ -104,7 +104,7 @@ SESSION_COOKIE_HTTPONLY = True
|
|||
|
||||
# let's go with one year because that's the way to do it now
|
||||
STS = False
|
||||
if (get_from_env('HSTS', '0') == '1'):
|
||||
if get_from_env('HSTS', '0') == '1':
|
||||
STS = True
|
||||
# we're using our own custom middleware now
|
||||
# SECURE_HSTS_SECONDS = 31536000
|
||||
|
|
Loading…
Reference in New Issue