1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
import os
import sys
import django
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
join = lambda p: os.path.abspath(os.path.join(PROJECT_ROOT, p))
# TODO configure pytest testpaths instead of doing this
sys.path.insert(0, join('..'))
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': join('db.sqlite'),
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
if os.environ.get('USE_POSTGRES'):
DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
DATABASES['default']['HOST'] = os.environ.get('POSTGRES_HOST', '')
DATABASES['default']['PORT'] = int(os.environ.get('POSTGRES_PORT', '5432'))
DATABASES['default']['USER'] = os.environ.get('POSTGRES_USER', '')
DATABASES['default']['PASSWORD'] = os.environ.get('POSTGRES_PASSWORD', '')
DATABASES['default']['NAME'] = os.environ.get(
'POSTGRES_DB', 'django_webtest_tests'
)
SITE_ID = 1
ROOT_URLCONF = 'urls'
SECRET_KEY = '5mcs97ar-(nnxhfkx0%^+0^sr!e(ax=x$2-!8dqy25ff-l1*a='
DEBUG = False
USE_I18N = True
USE_L10N = True
TIME_ZONE = 'America/Chicago'
LANGUAGE_CODE = 'en-us'
MEDIA_ROOT = join('media')
MEDIA_URL = '/media/'
STATIC_URL = '/static/'
LOGIN_REDIRECT_URL = '/template/index.html'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'debug': DEBUG,
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
],
},
},
]
if django.VERSION < (1, 10):
TEMPLATE_DEBUG = DEBUG
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
TEMPLATE_DIRS = (
join('templates'),
)
MIDDLEWARE = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'testapp_tests.middleware.UserMiddleware',
)
if django.VERSION < (1, 10):
MIDDLEWARE_CLASSES = MIDDLEWARE
del MIDDLEWARE
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django_webtest',
'django_webtest_tests',
'django_webtest_tests.testapp_tests',
)
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|