forked from divio/aldryn-newsblog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_settings.py
executable file
·174 lines (165 loc) · 5.42 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
173
174
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from distutils.version import LooseVersion
from django import get_version
from cms import __version__ as cms_string_version
import os
django_version = LooseVersion(get_version())
cms_version = LooseVersion(cms_string_version)
HELPER_SETTINGS = {
'TIME_ZONE': 'Europe/Zurich',
'INSTALLED_APPS': [
'aldryn_apphooks_config',
'aldryn_categories',
'aldryn_people',
'aldryn_reversion',
'aldryn_translation_tools',
'djangocms_text_ckeditor',
'easy_thumbnails',
'filer',
'mptt',
'parler',
'reversion',
'sortedm2m',
'taggit',
],
'TEMPLATE_DIRS': (
os.path.join(
os.path.dirname(__file__),
'aldryn_newsblog', 'tests', 'templates'),
),
'ALDRYN_NEWSBLOG_TEMPLATE_PREFIXES': [('dummy', 'dummy'), ],
'CMS_PERMISSION': True,
'SITE_ID': 1,
'LANGUAGES': (
('en', 'English'),
('de', 'German'),
('fr', 'French'),
),
'CMS_LANGUAGES': {
1: [
{
'code': 'en',
'name': 'English',
'fallbacks': ['de', 'fr', ]
},
{
'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': 'it',
'name': 'Italiano',
'fallbacks': ['fr', ] # FOR TESTING, LEAVE AS ONLY 'fr'
},
],
'default': {
'redirect_on_fallback': True, # PLEASE DO NOT CHANGE THIS
}
},
# app-specific
'PARLER_LANGUAGES': {
1: [
{
'code': 'en',
'fallbacks': ['de', ],
},
{
'code': 'de',
'fallbacks': ['en', ],
},
],
'default': {
'code': 'en',
'fallbacks': ['en'],
'hide_untranslated': False
}
},
#
# NOTE: The following setting `PARLER_ENABLE_CACHING = False` is required
# for tests to pass.
#
# There appears to be a bug in Parler which leaves translations in Parler's
# cache even after the parent object has been deleted. In production
# environments, this is unlikely to affect anything, because newly created
# objects will have new IDs. In testing, new objects are created with IDs
# that were previously used, which reveals this issue.
#
'PARLER_ENABLE_CACHING': False,
'ALDRYN_SEARCH_DEFAULT_LANGUAGE': 'en',
'HAYSTACK_CONNECTIONS': {
'default': {
'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
},
'de': {
'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
},
},
'THUMBNAIL_HIGH_RESOLUTION': True,
'THUMBNAIL_PROCESSORS': (
'easy_thumbnails.processors.colorspace',
'easy_thumbnails.processors.autocrop',
# 'easy_thumbnails.processors.scale_and_crop',
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters',
),
# 'DATABASES': {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': 'mydatabase',
# },
# 'mysql': {
# 'ENGINE': 'django.db.backends.mysql',
# 'NAME': 'newsblog_test',
# 'USER': 'root',
# 'PASSWORD': '',
# 'HOST': '',
# 'PORT': '3306',
# },
# 'postgres': {
# 'ENGINE': 'django.db.backends.postgresql_psycopg2',
# 'NAME': 'newsblog_test',
# 'USER': 'test',
# 'PASSWORD': '',
# 'HOST': '127.0.0.1',
# 'PORT': '5432',
# }
# }
# This set of MW classes should work for Django 1.6 and 1.7.
'MIDDLEWARE_CLASSES': [
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
# NOTE: This will actually be removed below in CMS<3.2 installs.
'cms.middleware.utils.ApphookReloadMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware'
]
}
# 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
# --boilerplate option will ensure correct boilerplate settings are
# added to settings
runner.cms('aldryn_newsblog', extra_args=[])
if __name__ == "__main__":
run()