Last active
June 11, 2021 18:05
-
-
Save cocomatias/c8f1c9e9dc57309fe8c9665be8665d1e to your computer and use it in GitHub Desktop.
Django Rest, Postgres ( Travis CI ) DATABASES settings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Database | |
import dj_database_url | |
POSTGRES_URL = "HEROKU_POSTGRESQL_PURPLE_URL" # The name of your Heroku Postgres database URL | |
if 'DATABASES' not in locals(): | |
DATABASES = {} | |
DATABASES['default'] = dj_database_url.config(default='postgres://POSTGRES_USERNAME:POSTGRES_PASSWORD@localhost:5432/POSTGRES_DATABASE_NAME') | |
if POSTGRES_URL in os.environ: | |
DATABASES = {} | |
DATABASES['default'] = dj_database_url.config(default=os.environ[POSTGRES_URL]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment