Skip to content

Commit

Permalink
Merge pull request #4 from jskcheqpl/master
Browse files Browse the repository at this point in the history
Heroku enabled database url
  • Loading branch information
xinulsw committed Dec 30, 2016
2 parents 4b0b961 + 2bef397 commit 8baddc7
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions malybar/malybar/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,29 @@
# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
if "DATABASE_URL" in os.environ:
# Do not read it here, it would be visible in debug
# find HIDDEN_SETTINGS to see what is cleansed by default
# DATABASE_URL = os.environ['DATABASE_URL']
import dj_database_url

DATABASES = {
"default": dj_database_url.config()
}
# Make sure we use GIS enabled engine
DATABASES['default']['ENGINE'] = 'django.contrib.gis.db.backends.postgis'
DATABASES['default']['TEST'] = {'NAME': os.environ.get("DATABASE_TEST_NAME", None)}
DATABASES['default']['OPTIONS'] = {
'options': '-c search_path=gis,public,pg_catalog'
}
else:
# Use local sqlite3 database
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
}


# Password validation
Expand Down

0 comments on commit 8baddc7

Please sign in to comment.