Commit 788a7067 by John Jarvis

updating production settings to read in everything from a yaml file

parent 68e27ba8
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
from os import environ from os import environ
from base import * from base import *
import yaml
# Normally you should not import ANYTHING from Django directly # Normally you should not import ANYTHING from Django directly
# into your settings, but ImproperlyConfigured is an exception. # into your settings, but ImproperlyConfigured is an exception.
...@@ -23,53 +23,10 @@ def get_env_setting(setting): ...@@ -23,53 +23,10 @@ def get_env_setting(setting):
ALLOWED_HOSTS = ['*'] ALLOWED_HOSTS = ['*']
########## END HOST CONFIGURATION ########## END HOST CONFIGURATION
########## EMAIL CONFIGURATION CONFIG_FILE=get_env_setting('ANALYTICS_API_CFG')
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-host
EMAIL_HOST = environ.get('EMAIL_HOST', 'smtp.gmail.com')
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-host-password
EMAIL_HOST_PASSWORD = environ.get('EMAIL_HOST_PASSWORD', '')
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-host-user
EMAIL_HOST_USER = environ.get('EMAIL_HOST_USER', 'your_email@example.com')
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-port
EMAIL_PORT = environ.get('EMAIL_PORT', 587)
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-subject-prefix
EMAIL_SUBJECT_PREFIX = '[%s] ' % SITE_NAME
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-use-tls
EMAIL_USE_TLS = True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#server-email
SERVER_EMAIL = EMAIL_HOST_USER
########## END EMAIL CONFIGURATION
########## DATABASE CONFIGURATION
DATABASES = {
'default': {
'ENGINE': environ.get('DATABASE_ENGINE', 'django.db.backends.mysql'),
'NAME': get_env_setting('DATABASE_NAME'),
'USER': get_env_setting('DATABASE_USER'),
'PASSWORD': get_env_setting('DATABASE_PASSWORD'),
'HOST': environ.get('DATABASE_HOST', 'localhost'),
'PORT': environ.get('DATABASE_PORT', '3306'),
}
}
########## END DATABASE CONFIGURATION
########## CACHE CONFIGURATION with open(CONFIG_FILE) as f:
# See: https://docs.djangoproject.com/en/dev/ref/settings/#caches config_from_yaml = yaml.load(f)
CACHES = {}
########## END CACHE CONFIGURATION
vars().update(config_from_yaml)
########## SECRET CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
SECRET_KEY = get_env_setting('SECRET_KEY')
########## END SECRET CONFIGURATION
...@@ -3,3 +3,4 @@ django-model-utils==1.4.0 ...@@ -3,3 +3,4 @@ django-model-utils==1.4.0
South==0.8.1 South==0.8.1
djangorestframework==2.3.5 djangorestframework==2.3.5
Markdown==2.4.1 Markdown==2.4.1
ipython==2.1.0
...@@ -4,3 +4,5 @@ ...@@ -4,3 +4,5 @@
gunicorn==0.17.4 gunicorn==0.17.4
MySQL-python==1.2.5 MySQL-python==1.2.5
path.py==5.2
PyYAML==3.11
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment