Can't add secrets.py to heroku so environ instead

This commit is contained in:
Tyler Hallada 2014-07-28 19:09:07 -04:00
parent 000d63d49b
commit f310757764

View File

@ -14,7 +14,18 @@ MANAGERS = ADMINS
PROJECT_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..') PROJECT_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')
DATABASES = { if os.environ.get('DJANGO_ENV', None) == 'heroku':
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': os.environ.get('DJANGO_DATABASE_NAME'),
'USER': os.environ.get('DJANGO_DATABASE_USER'),
'PASSWORD': os.environ.get('DJANGO_DATABASE_PASSWORD'),
'HOST': os.environ.get('DJANGO_DATABASE_HOST'),
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
else:
DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.mysql', 'ENGINE': 'django.db.backends.mysql',
'NAME': secrets.DATABASE_NAME, 'NAME': secrets.DATABASE_NAME,
@ -23,7 +34,7 @@ DATABASES = {
'HOST': secrets.DATABASE_HOST, 'HOST': secrets.DATABASE_HOST,
'PORT': '', # Set to empty string for default. Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3.
} }
} }
# Hosts/domain names that are valid for this site; required if DEBUG is False # Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts