Skip to content
Snippets Groups Projects
Commit 743effb5 authored by Noah Zoschke's avatar Noah Zoschke
Browse files

Merge pull request #8 from kencochrane/master

Change to fix an issue when DATABASES isn't declared in settings.py
parents 47d889c1 4a863b52
No related branches found
No related tags found
No related merge requests found
...@@ -94,8 +94,16 @@ import os, sys, urlparse ...@@ -94,8 +94,16 @@ import os, sys, urlparse
urlparse.uses_netloc.append('postgres') urlparse.uses_netloc.append('postgres')
urlparse.uses_netloc.append('mysql') urlparse.uses_netloc.append('mysql')
try: try:
if os.environ.has_key('DATABASE_URL') and DATABASES != None:
#check to make sure DATABASES is set in settings.py file.If not default to {}
try:
DATABASES
except NameError:
DATABASES = {}
if os.environ.has_key('DATABASE_URL'):
url = urlparse.urlparse(os.environ['DATABASE_URL']) url = urlparse.urlparse(os.environ['DATABASE_URL'])
DATABASES['default'] = { DATABASES['default'] = {
'NAME': url.path[1:], 'NAME': url.path[1:],
'USER': url.username, 'USER': url.username,
......
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