Skip to content

Instantly share code, notes, and snippets.

@gamorales
Created January 12, 2020 13:44
Show Gist options
  • Save gamorales/6f6b77d6e89606f8dfdba4c171c2f949 to your computer and use it in GitHub Desktop.
Save gamorales/6f6b77d6e89606f8dfdba4c171c2f949 to your computer and use it in GitHub Desktop.
Run test with different database
import sys
import os
# ...
# settings.py extra configurations
# ...
if sys.argv[1] == 'test':
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
else:
DATABASES = {'default': 'psql://user:password@server:5432/database'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment