Can't add secrets.py to heroku so environ instead
This commit is contained in:
parent
000d63d49b
commit
f310757764
@ -14,16 +14,27 @@ 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':
|
||||||
'default': {
|
DATABASES = {
|
||||||
'ENGINE': 'django.db.backends.mysql',
|
'default': {
|
||||||
'NAME': secrets.DATABASE_NAME,
|
'ENGINE': 'django.db.backends.mysql',
|
||||||
'USER': secrets.DATABASE_USER,
|
'NAME': os.environ.get('DJANGO_DATABASE_NAME'),
|
||||||
'PASSWORD': secrets.DATABASE_PASSWORD,
|
'USER': os.environ.get('DJANGO_DATABASE_USER'),
|
||||||
'HOST': secrets.DATABASE_HOST,
|
'PASSWORD': os.environ.get('DJANGO_DATABASE_PASSWORD'),
|
||||||
'PORT': '', # Set to empty string for default. Not used with sqlite3.
|
'HOST': os.environ.get('DJANGO_DATABASE_HOST'),
|
||||||
|
'PORT': '', # Set to empty string for default. Not used with sqlite3.
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.mysql',
|
||||||
|
'NAME': secrets.DATABASE_NAME,
|
||||||
|
'USER': secrets.DATABASE_USER,
|
||||||
|
'PASSWORD': secrets.DATABASE_PASSWORD,
|
||||||
|
'HOST': secrets.DATABASE_HOST,
|
||||||
|
'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
|
||||||
|
Loading…
Reference in New Issue
Block a user