Skip to content
Snippets Groups Projects
Commit 6a05ef1d authored by Dave Paola's avatar Dave Paola
Browse files

DATABASES uses update() instead of being set explicitly, to preserve options

parent 743effb5
No related branches found
No related tags found
No related merge requests found
...@@ -104,13 +104,15 @@ try: ...@@ -104,13 +104,15 @@ try:
if os.environ.has_key('DATABASE_URL'): if os.environ.has_key('DATABASE_URL'):
url = urlparse.urlparse(os.environ['DATABASE_URL']) url = urlparse.urlparse(os.environ['DATABASE_URL'])
DATABASES['default'] = { # We use update here to preserve other keys we
# don't care about (like OPTIONS)
DATABASES['default'].update({
'NAME': url.path[1:], 'NAME': url.path[1:],
'USER': url.username, 'USER': url.username,
'PASSWORD': url.password, 'PASSWORD': url.password,
'HOST': url.hostname, 'HOST': url.hostname,
'PORT': url.port, 'PORT': url.port,
} })
if url.scheme == 'postgres': if url.scheme == 'postgres':
DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2' DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
if url.scheme == 'mysql': if url.scheme == 'mysql':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment