Skip to content

Instantly share code, notes, and snippets.

@SeanHayes
Created January 6, 2010 01:31
Show Gist options
  • Save SeanHayes/269919 to your computer and use it in GitHub Desktop.
Save SeanHayes/269919 to your computer and use it in GitHub Desktop.
Test Settings/Test Database in Django
#normal settings.py stuff should go above this comment
#if manage.py test was called, use test settings
if 'test' in sys.argv:
try:
from test_settings import *
except ImportError:
pass
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'my_db', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
@romantomjak
Copy link

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment