forked from theatlantic/django-nested-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.py
129 lines (107 loc) · 3.47 KB
/
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import glob
import os
import tempfile
import django
import selenosis.settings
import dj_database_url
current_dir = os.path.abspath(os.path.dirname(__file__))
temp_dir = tempfile.mkdtemp()
DEBUG = NESTED_ADMIN_DEBUG = True
DATABASES = {
'default': dj_database_url.parse(os.environ.get('DATABASE_URL', 'sqlite://:memory:')),
}
SECRET_KEY = 'z-i*xqqn)r0i7leak^#clq6y5j8&tfslp^a4duaywj2$**s*0_'
MIGRATION_MODULES = {
'auth': None,
'contenttypes': None,
'sessions': None,
}
try:
import grappelli # noqa
except ImportError:
try:
import suit # noqa
except ImportError:
INSTALLED_APPS = tuple([])
else:
INSTALLED_APPS = tuple(['suit'])
SUIT_CONFIG = {'CONFIRM_UNSAVED_CHANGES': False}
else:
INSTALLED_APPS = tuple(['grappelli'])
polymorphic = None
TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': selenosis.settings.TEMPLATES[0]['DIRS'],
'APP_DIRS': True,
'OPTIONS': {
'debug': True,
'string_if_invalid': 'INVALID {{ %s }}',
'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.template.context_processors.request',
'django.contrib.messages.context_processors.messages',
],
},
}]
if 'suit' in INSTALLED_APPS:
# django-suit has issues with string_if_invalid,
# so don't use this setting if testing suit.
TEMPLATES[0]['OPTIONS'].pop('string_if_invalid')
INSTALLED_APPS += (
'selenosis',
'nested_admin.tests',
'nested_admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.messages',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.staticfiles',
'django.contrib.admin',
)
# Add apps within the tests folder
for p in glob.glob(os.path.join(current_dir, '*', 'models.py')):
INSTALLED_APPS += tuple(["nested_admin.tests.%s" %
os.path.basename(os.path.dirname(p))])
if polymorphic is not None:
for p in glob.glob(os.path.join(current_dir, 'nested_polymorphic/*/models.py')):
INSTALLED_APPS += tuple(["nested_admin.tests.nested_polymorphic.%s" %
os.path.basename(os.path.dirname(p))])
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'class': 'logging.StreamHandler',
},
},
'loggers': {
'nested_admin.tests': {
'handlers': ['console'],
'level': 'WARNING',
},
},
}
SITE_ID = 1
ROOT_URLCONF = 'nested_admin.tests.urls'
MEDIA_ROOT = os.path.join(temp_dir, 'media')
MEDIA_URL = '/media/'
STATIC_URL = '/static/'
DEBUG_PROPAGATE_EXCEPTIONS = True
TEST_RUNNER = 'selenosis.DiscoverRunner'
AWS_S3_REGION_NAME = "us-east-1"
AWS_STORAGE_BUCKET_NAME = 'django-nested-admin-artifacts'