mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
Merge pull request #8 from kencochrane/master
Change to fix an issue when DATABASES isn't declared in settings.py
This commit is contained in:
+9
-1
@@ -94,8 +94,16 @@ import os, sys, urlparse
|
||||
urlparse.uses_netloc.append('postgres')
|
||||
urlparse.uses_netloc.append('mysql')
|
||||
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'])
|
||||
|
||||
DATABASES['default'] = {
|
||||
'NAME': url.path[1:],
|
||||
'USER': url.username,
|
||||
|
||||
Reference in New Issue
Block a user