forked from divio/aldryn-people
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_settings.py
172 lines (158 loc) · 5.5 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django
from distutils.version import LooseVersion
from cms import __version__ as cms_string_version
cms_version = LooseVersion(cms_string_version)
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
'URL': 'http://localhost:9001/solr/default',
'TIMEOUT': 60 * 5,
'INCLUDE_SPELLING': True,
'BATCH_SIZE': 100,
'EXCLUDED_INDEXES': ['thirdpartyapp.search_indexes.BarIndex'],
},
'en': {
'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
'URL': 'http://my-solr-server/solr/my-site-en/',
'TIMEOUT': 60 * 5,
'INCLUDE_SPELLING': True,
'BATCH_SIZE': 100,
},
'de': {
'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
'URL': 'http://my-solr-server/solr/my-site-de/',
'TIMEOUT': 60 * 5,
'INCLUDE_SPELLING': True,
'BATCH_SIZE': 100,
},
}
HELPER_SETTINGS = {
'TIME_ZONE': 'Europe/Zurich',
'HAYSTACK_CONNECTIONS': HAYSTACK_CONNECTIONS,
'INSTALLED_APPS': [
'aldryn_common',
'aldryn_reversion',
'aldryn_translation_tools',
'djangocms_text_ckeditor',
'easy_thumbnails',
'filer',
'parler',
'reversion',
'sortedm2m',
],
'THUMBNAIL_PROCESSORS': (
'easy_thumbnails.processors.colorspace',
'easy_thumbnails.processors.autocrop',
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters',
),
'CMS_PERMISSION': True,
# At present, testing requires bootstrap to be disabled.
# 'ALDRYN_BOILERPLATE_NAME': 'bootstrap3',
'LANGUAGES': (
('en', 'English'),
('de', 'German'),
('fr', 'French'),
),
'CMS_LANGUAGES': {
1: [
{
'code': 'de',
'name': 'Deutsche',
'fallbacks': ['en', ] # FOR TESTING DO NOT ADD 'fr' HERE
},
{
'code': 'fr',
'name': 'Française',
'fallbacks': ['en', ] # FOR TESTING DO NOT ADD 'de' HERE
},
{
'code': 'en',
'name': 'English',
'fallbacks': ['de', 'fr', ]
},
{
'code': 'it',
'name': 'Italiano',
'fallbacks': ['fr', ] # FOR TESTING, LEAVE AS ONLY 'fr'
},
],
},
# app-specific
'PARLER_LANGUAGES': {
1: [
{
'code': u'en',
'fallbacks': ['de', 'fr'],
'hide_untranslated': False
},
{
'code': u'fr',
'fallbacks': [u'en'],
'hide_untranslated': False
},
{
'code': u'de',
'fallbacks': [u'en'],
'hide_untranslated': False
}
],
'default': {
'code': u'en',
'fallbacks': [u'en'],
'hide_untranslated': False}
},
'PARLER_ENABLE_CACHING': False,
}
# This set of MW classes should work for Django 1.6 and 1.7.
MIDDLEWARE_CLASSES_16_17 = [
'cms.middleware.utils.ApphookReloadMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware'
]
MIDDLEWARE_CLASSES_18 = [
'cms.middleware.utils.ApphookReloadMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware',
]
# Use PEP 386-compliant version number
django_version = django.get_version()
if django_version.startswith('1.6.') or django_version.startswith('1.7.'):
HELPER_SETTINGS['MIDDLEWARE_CLASSES'] = MIDDLEWARE_CLASSES_16_17
else:
HELPER_SETTINGS['MIDDLEWARE_CLASSES'] = MIDDLEWARE_CLASSES_18
# If using CMS 3.2+, use the CMS middleware for ApphookReloading, otherwise,
# use aldryn_apphook_reload's.
if cms_version < LooseVersion('3.2.0'):
HELPER_SETTINGS['MIDDLEWARE_CLASSES'].remove(
'cms.middleware.utils.ApphookReloadMiddleware')
HELPER_SETTINGS['MIDDLEWARE_CLASSES'].insert(
0, 'aldryn_apphook_reload.middleware.ApphookReloadMiddleware')
HELPER_SETTINGS['INSTALLED_APPS'].insert(
0, 'aldryn_apphook_reload')
def run():
from djangocms_helper import runner
runner.cms('aldryn_people', extra_args=[]) # , extra_args=['--boilerplate']
if __name__ == "__main__":
run()