Skip to content

Commit

Permalink
Wrap the database settings in an exception.
Browse files Browse the repository at this point in the history
Locally, we will not have anything defined but we will want the
various ./manage.py commands to work correctly though.
  • Loading branch information
akumria committed Jun 5, 2012
1 parent a09d339 commit a7d978d
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions paas/settings/heroku.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@
urlparse.uses_netloc.append('postgres')

# Grab database info
db_url = urlparse.urlparse(os.environ['DATABASE_URL'])
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': db_url.path[1:],
'USER': db_url.username,
'PASSWORD': db_url.password,
'HOST': db_url.hostname,
'PORT': db_url.port,
try:
db_url = urlparse.urlparse(os.environ['DATABASE_URL'])
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': db_url.path[1:],
'USER': db_url.username,
'PASSWORD': db_url.password,
'HOST': db_url.hostname,
'PORT': db_url.port,
}
}
}
except KeyError:
pass

0 comments on commit a7d978d

Please sign in to comment.