Last active
June 24, 2022 14:02
-
-
Save bergantine/4035311 to your computer and use it in GitHub Desktop.
Django: Specify Test Database. #django #test #database
This file contains hidden or 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
| # Useful if dev settings are pointed at the production or staging database on a remote host | |
| # In the dev settings, after the `DATABASES` configuration, add a second wrapped in an `if` statement | |
| import sys | |
| if 'test' in sys.argv: | |
| DATABASES = { | |
| 'default': { | |
| 'ENGINE': 'django.db.backends.postgresql_psycopg2', | |
| 'NAME': 'django_db', | |
| 'USER': 'django_login', | |
| 'PASSWORD': 'secret', | |
| 'HOST': '', | |
| 'PORT': '', | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Evil but working