Skip to content
Snippets Groups Projects
Commit 4a863b52 authored by Ken Cochrane's avatar Ken Cochrane
Browse files

made it so that the compile doesn't fail if the DATABASES variable doesn't exist in settings.py

parent 47d889c1
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