Skip to content
Snippets Groups Projects
Commit 8e217d31 authored by Ben Adida's avatar Ben Adida
Browse files

ok now with new settings file

parent a446b704
No related branches found
No related tags found
No related merge requests found
import os import os
DEBUG = True # go through environment variables and override them
def get_from_env(var, default):
if os.environ.has_key(var):
return os.environ[var]
else:
return default
DEBUG = False
TEMPLATE_DEBUG = DEBUG TEMPLATE_DEBUG = DEBUG
ADMINS = ( ADMINS = (
# ('Your Name', 'your_email@domain.com'), ('Ben Adida', 'ben@adida.net'),
) )
MANAGERS = ADMINS MANAGERS = ADMINS
DATABASE_ENGINE = 'postgresql_psycopg2' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. DATABASES = {
DATABASE_NAME = 'helios' # Or path to database file if using sqlite3. 'default': {
DATABASE_USER = '' # Not used with sqlite3. 'ENGINE': 'django.db.backends.postgresql_psycopg2',
DATABASE_PASSWORD = '' # Not used with sqlite3. 'NAME': 'helios'
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. }
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. }
# Local time zone for this installation. Choices can be found here: # Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
...@@ -49,7 +56,7 @@ MEDIA_URL = '' ...@@ -49,7 +56,7 @@ MEDIA_URL = ''
ADMIN_MEDIA_PREFIX = '/media/' ADMIN_MEDIA_PREFIX = '/media/'
# Make this unique, and don't share it with anybody. # Make this unique, and don't share it with anybody.
SECRET_KEY = 'replaceme' SECRET_KEY = get_from_env('SECRET_KEY', 'replaceme')
# List of callables that know how to import templates from various sources. # List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = ( TEMPLATE_LOADERS = (
...@@ -79,6 +86,7 @@ INSTALLED_APPS = ( ...@@ -79,6 +86,7 @@ INSTALLED_APPS = (
'django.contrib.sites', 'django.contrib.sites',
## needed for queues ## needed for queues
'djcelery', 'djcelery',
'djkombu',
## needed for schema migration ## needed for schema migration
'south', 'south',
## HELIOS stuff ## HELIOS stuff
...@@ -99,8 +107,8 @@ VOTER_UPLOAD_REL_PATH = "voters/%Y/%m/%d" ...@@ -99,8 +107,8 @@ VOTER_UPLOAD_REL_PATH = "voters/%Y/%m/%d"
# Change your email settings # Change your email settings
DEFAULT_FROM_EMAIL = 'ben@adida.net' DEFAULT_FROM_EMAIL = get_from_env('DEFAULT_FROM_EMAIL', 'ben@adida.net')
DEFAULT_FROM_NAME = 'Ben for Helios' DEFAULT_FROM_NAME = get_from_env('DEFAULT_FROM_NAME', 'Ben for Helios')
SERVER_EMAIL = '%s <%s>' % (DEFAULT_FROM_NAME, DEFAULT_FROM_EMAIL) SERVER_EMAIL = '%s <%s>' % (DEFAULT_FROM_NAME, DEFAULT_FROM_EMAIL)
LOGIN_URL = '/auth/' LOGIN_URL = '/auth/'
...@@ -108,21 +116,21 @@ LOGOUT_ON_CONFIRMATION = True ...@@ -108,21 +116,21 @@ LOGOUT_ON_CONFIRMATION = True
# The two hosts are here so the main site can be over plain HTTP # The two hosts are here so the main site can be over plain HTTP
# while the voting URLs are served over SSL. # while the voting URLs are served over SSL.
URL_HOST = "http://localhost:8000" URL_HOST = get_from_env("URL_HOST", "http://localhost:8000")
# IMPORTANT: you should not change this setting once you've created # IMPORTANT: you should not change this setting once you've created
# elections, as your elections' cast_url will then be incorrect. # elections, as your elections' cast_url will then be incorrect.
# SECURE_URL_HOST = "https://localhost:8443" # SECURE_URL_HOST = "https://localhost:8443"
SECURE_URL_HOST = "http://localhost:8000" SECURE_URL_HOST = get_from_env("SECURE_URL_HOST", "http://localhost:8000")
# this additional host is used to iframe-isolate the social buttons, # this additional host is used to iframe-isolate the social buttons,
# which usually involve hooking in remote JavaScript, which could be # which usually involve hooking in remote JavaScript, which could be
# a security issue. Plus, if there's a loading issue, it blocks the whole # a security issue. Plus, if there's a loading issue, it blocks the whole
# page. Not cool. # page. Not cool.
SOCIALBUTTONS_URL_HOST= "http://localhost:8000" SOCIALBUTTONS_URL_HOST= get_from_env("SOCIALBUTTONS_URL_HOST", "http://localhost:8000")
# election stuff # election stuff
SITE_TITLE = 'Helios Election Server' SITE_TITLE = get_from_env('SITE_TITLE', 'Helios Election Server')
# FOOTER links # FOOTER links
FOOTER_LINKS = [] FOOTER_LINKS = []
...@@ -160,10 +168,10 @@ LINKEDIN_API_KEY = '' ...@@ -160,10 +168,10 @@ LINKEDIN_API_KEY = ''
LINKEDIN_API_SECRET = '' LINKEDIN_API_SECRET = ''
# email server # email server
EMAIL_HOST = 'localhost' EMAIL_HOST = get_from_env('EMAIL_HOST', 'localhost')
EMAIL_PORT = 1025 EMAIL_PORT = 2525
EMAIL_HOST_USER = '' EMAIL_HOST_USER = get_from_env('EMAIL_HOST_USER', '')
EMAIL_HOST_PASSWORD = '' EMAIL_HOST_PASSWORD = get_from_env('EMAIL_HOST_PASSWORD', '')
EMAIL_USE_TLS = False EMAIL_USE_TLS = False
# set up logging # set up logging
...@@ -174,11 +182,7 @@ logging.basicConfig( ...@@ -174,11 +182,7 @@ logging.basicConfig(
) )
# set up django-celery # set up django-celery
BROKER_HOST = "localhost"
BROKER_PORT = 5672
BROKER_USER = "guest"
BROKER_PASSWORD = "guest"
BROKER_VHOST = "/"
import djcelery import djcelery
djcelery.setup_loader() djcelery.setup_loader()
BROKER_BACKEND = "djkombu.transport.DatabaseTransport"
CELERY_RESULT_DBURI = DATABASES['default']
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment