-
-
Notifications
You must be signed in to change notification settings - Fork 258
/
test_settings.py
110 lines (89 loc) · 2.51 KB
/
test_settings.py
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
108
109
110
import os
try:
import django_jinja
JINJA_INSTALLED = True
except ImportError:
JINJA_INSTALLED = False
# Make filepaths relative to settings.
ROOT = os.path.dirname(os.path.abspath(__file__))
path = lambda *a: os.path.join(ROOT, *a) # noqa: E731
DEBUG = True
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
JINJA_CONFIG = {}
SITE_ID = 1
USE_I18N = False
SECRET_KEY = 'foobar'
DATABASES = {
'default': {
'NAME': 'test.db',
'ENGINE': 'django.db.backends.sqlite3',
},
# Provide a readonly DB for testing DB replication scenarios.
'readonly': {
'NAME': 'test.readonly.db',
'ENGINE': 'django.db.backends.sqlite3',
}
}
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'waffle',
'test_app',
)
MIDDLEWARE = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'waffle.middleware.WaffleMiddleware',
)
ROOT_URLCONF = 'test_app.urls'
_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.request',
'django.contrib.messages.context_processors.messages',
)
if JINJA_INSTALLED:
TEMPLATES = [
{
'BACKEND': 'django_jinja.backend.Jinja2',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'match_regex': r'jinja.*',
'match_extension': '',
'newstyle_gettext': True,
'context_processors': _CONTEXT_PROCESSORS,
'undefined': 'jinja2.Undefined',
'extensions': [
'jinja2.ext.i18n',
'waffle.jinja.WaffleExtension',
],
}
}
]
else:
TEMPLATES = []
TEMPLATES.append(
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'debug': DEBUG,
'context_processors': _CONTEXT_PROCESSORS,
}
}
)
WAFFLE_FLAG_DEFAULT = False
WAFFLE_SWITCH_DEFAULT = False
WAFFLE_SAMPLE_DEFAULT = False
WAFFLE_READ_FROM_WRITE_DB = False
WAFFLE_OVERRIDE = False
WAFFLE_ENABLE_ADMIN_PAGES = True
WAFFLE_CACHE_PREFIX = 'test:'