~widelands-dev/widelands-website/trunk

« back to all changes in this revision

Viewing changes to settings.py

  • Committer: franku
  • Date: 2016-07-02 12:38:06 UTC
  • mfrom: (404.2.56 widelands)
  • Revision ID: somal@arcor.de-20160702123806-q69u3d48s1prrxds
merged the django1_8 branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Django settings for widelands project.
2
2
 
 
3
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
 
4
import os
 
5
 
 
6
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))+ '/widelands'
3
7
DEBUG = True
4
 
TEMPLATE_DEBUG = DEBUG
5
8
 
6
9
ADMINS = (
7
10
    # ('Your Name', 'your_email@domain.com'),
10
13
MANAGERS = ADMINS
11
14
 
12
15
DATABASES = {
13
 
   'default': {
14
 
      'ENGINE': 'django.db.backends.sqlite3',
15
 
      'NAME': 'dev.db',
16
 
      'USER': '',      # Not used with sqlite3.
17
 
      'PASSWORD': '',  # Not used with sqlite3.
18
 
      'HOST': '',      # Set to empty string for localhost. Not used with sqlite3.
19
 
      'PORT': '',      # Set to empty string for default. Not used with sqlite3.
20
 
   }
 
16
    'default': {
 
17
        'ENGINE': 'django.db.backends.sqlite3',
 
18
        'NAME': 'dev.db',
 
19
        'USER': '',      # Not used with sqlite3.
 
20
        'PASSWORD': '',  # Not used with sqlite3.
 
21
        # Set to empty string for localhost. Not used with sqlite3.
 
22
        'HOST': '',
 
23
        # Set to empty string for default. Not used with sqlite3.
 
24
        'PORT': '',
 
25
    }
21
26
}
22
27
 
23
28
# Local time zone for this installation. Choices can be found here:
26
31
# If running in a Windows environment this must be set to the same as your
27
32
# system time zone.
28
33
TIME_ZONE = 'Europe/Berlin'
 
34
USE_TZ = False # See https://docs.djangoproject.com/en/1.8/ref/settings/#std:setting-TIME_ZONE
29
35
 
30
36
# Language code for this installation. All choices can be found here:
31
37
# http://www.i18nguy.com/unicode/language-identifiers.html
34
40
SITE_ID = 1
35
41
 
36
42
# Where should logged in user go by default?
37
 
LOGIN_REDIRECT_URL="/"
 
43
LOGIN_REDIRECT_URL = '/'
38
44
 
39
45
# If you set this to False, Django will make some optimizations so as not
40
46
# to load the internationalization machinery.
49
55
# Examples: "http://media.lawrence.com", "http://example.com/media/"
50
56
MEDIA_URL = '/wlmedia/'
51
57
 
52
 
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
53
 
# trailing slash.
54
 
# Examples: "http://foo.com/media/", "/media/".
55
 
ADMIN_MEDIA_PREFIX = '/media/'
56
 
 
57
58
# Make this unique, and don't share it with anybody.
58
59
SECRET_KEY = '#*bc7*q0-br42fc&6l^x@zzk&(=-#gr!)fn@t30n54n05jkqcu'
59
60
 
60
 
# List of callables that know how to import templates from various sources.
61
 
TEMPLATE_LOADERS = (
62
 
    'django.template.loaders.filesystem.Loader',
63
 
    'django.template.loaders.app_directories.Loader',
64
 
#     'django.template.loaders.eggs.load_template_source',
 
61
ROOT_URLCONF = 'urls'
 
62
 
 
63
# List of finder classes that know how to find static files in
 
64
# various locations.
 
65
STATICFILES_FINDERS = [
 
66
    "django.contrib.staticfiles.finders.FileSystemFinder",
 
67
    "django.contrib.staticfiles.finders.AppDirectoriesFinder",
 
68
]
 
69
 
 
70
INSTALLED_APPS = (
 
71
    'django.contrib.admin',
 
72
    'django.contrib.auth',
 
73
    'django.contrib.contenttypes',
 
74
    'django.contrib.sessions',
 
75
    'django.contrib.messages',
 
76
    'django.contrib.staticfiles',
 
77
    'django.contrib.sites',
 
78
    'django.contrib.humanize',
 
79
    'django_comments',
 
80
    'nocaptcha_recaptcha',
 
81
    # Thirdparty apps, but need preload
 
82
    'tracking', # included as wlapp
 
83
 
 
84
    # Our own apps
 
85
    'wiki.templatetags.restructuredtext',
 
86
    'mainpage',
 
87
    'wlhelp',
 
88
    'wlimages',
 
89
    'wlwebchat',
 
90
    'wlprofile',
 
91
    'wlsearch',
 
92
    'wlpoll',
 
93
    'wlevents',
 
94
    'wlmaps',
 
95
    'wlscreens',
 
96
    'wlggz',
 
97
 
 
98
    # Modified 3rd party apps
 
99
    'wiki',  # This is based on wikiapp, but has some local modifications
 
100
    'news',  # This is based on simple-blog, but has some local modifications
 
101
    'news.managers',
 
102
    'pybb',  # Feature enriched version of pybb
 
103
 
 
104
    # Thirdparty apps
 
105
    'threadedcomments', # included as wlapp
 
106
    'notification',     # included as wlapp
 
107
    'django_messages',
 
108
    #'pagination',
 
109
     'linaro_django_pagination',
 
110
    'tagging',
 
111
    'djangoratings',    # included as wlapp
 
112
    'sphinxdoc',        # included as wlapp
 
113
    #'south',           included in django itself
65
114
)
66
115
 
67
116
MIDDLEWARE_CLASSES = (
68
117
    # 'simplestats.middleware.RegexLoggingMiddleware',
69
 
    'django.middleware.gzip.GZipMiddleware', # Remove this, when load gets to high or attachments are enabled
70
118
    'django.middleware.common.CommonMiddleware',
71
119
    'django.contrib.sessions.middleware.SessionMiddleware',
 
120
    'django.contrib.messages.middleware.MessageMiddleware',
72
121
    'django.middleware.csrf.CsrfViewMiddleware',
73
122
    'django.contrib.auth.middleware.AuthenticationMiddleware',
74
 
    'pagination.middleware.PaginationMiddleware',
 
123
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 
124
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
 
125
    'django.middleware.security.SecurityMiddleware',
 
126
 
 
127
    # Remove this, when load gets to high or attachments are enabled
 
128
    'django.middleware.gzip.GZipMiddleware',
 
129
    #'pagination.middleware.PaginationMiddleware',
 
130
    'linaro_django_pagination.middleware.PaginationMiddleware',
75
131
    'tracking.middleware.VisitorTrackingMiddleware',
76
132
    'tracking.middleware.VisitorCleanUpMiddleware',
77
133
)
78
134
 
79
 
ROOT_URLCONF = 'widelands.urls'
80
 
 
81
 
TEMPLATE_DIRS = (
82
 
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
83
 
    # Always use forward slashes, even on Windows.
84
 
    # Don't forget to use absolute paths, not relative paths.
85
 
    '/var/www/django_projects/widelands/templates',
86
 
)
87
 
 
88
 
TEMPLATE_CONTEXT_PROCESSORS = (
89
 
    "django.contrib.auth.context_processors.auth",
90
 
    "django_messages.context_processors.inbox",
91
 
    "django.core.context_processors.debug",
92
 
    "django.core.context_processors.i18n",
93
 
    "django.core.context_processors.media",
94
 
    'django.core.context_processors.request',
95
 
    'widelands.mainpage.context_processors.settings_for_templates',
96
 
)
 
135
TEMPLATES = [
 
136
    {
 
137
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
 
138
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
 
139
        'APP_DIRS': True,
 
140
        'OPTIONS': {
 
141
            'context_processors': [
 
142
                'django.template.context_processors.debug',
 
143
                'django.template.context_processors.request',
 
144
                'django.contrib.auth.context_processors.auth',
 
145
                'django.contrib.messages.context_processors.messages',
 
146
                'django.template.context_processors.i18n',
 
147
                'django.template.context_processors.media',
 
148
                'django.template.context_processors.static',
 
149
                'django.template.context_processors.tz',
 
150
                'django_messages.context_processors.inbox',
 
151
                'mainpage.context_processors.settings_for_templates'
 
152
            ],
 
153
        },
 
154
    },
 
155
]
 
156
 
 
157
# Static files (CSS, JavaScript, Images)
 
158
# https://docs.djangoproject.com/en/1.8/howto/static-files/
 
159
STATIC_URL = '/media/'
97
160
 
98
161
############################
99
162
# Activation configuration #
100
163
############################
101
164
DEFAULT_FROM_EMAIL = 'noreply@widelands.org'
102
 
ACCOUNT_ACTIVATION_DAYS=2 # Days an activation token keeps active
 
165
ACCOUNT_ACTIVATION_DAYS = 2  # Days an activation token keeps active
103
166
 
104
167
######################
105
168
# Wiki configuration #
111
174
######################
112
175
# User configuration #
113
176
######################
114
 
AUTH_PROFILE_MODULE = 'wlprofile.Profile'
 
177
#AUTH_PROFILE_MODULE = 'wlprofile.Profile' # NOCOMM: This is not longer used anymore, see:
 
178
# https://docs.djangoproject.com/en/1.8/releases/1.5/#auth-profile-module
 
179
 
115
180
DEFAULT_TIME_ZONE = 3
116
 
DEFAULT_TIME_DISPLAY = r"%ND(Y-m-d,) H:i" #According to ISO 8601
117
 
DEFAULT_MARKUP ="markdown"
 
181
DEFAULT_TIME_DISPLAY = r"%ND(Y-m-d,) H:i"  # According to ISO 8601
 
182
DEFAULT_MARKUP = 'markdown'
118
183
SIGNATURE_MAX_LENGTH = 255
119
184
SIGNATURE_MAX_LINES = 8
120
 
AVATARS_UPLOAD_TO = "profile/avatars"
 
185
AVATARS_UPLOAD_TO = 'profile/avatars'
121
186
AVATAR_HEIGHT = AVATAR_WIDTH = 80
122
187
 
123
188
######################
124
189
# Pybb Configuration #
125
190
######################
126
 
PYBB_ATTACHMENT_ENABLE = False # disable gzip middleware when enabling attachments
 
191
PYBB_ATTACHMENT_ENABLE = False  # disable gzip middleware when enabling attachments
127
192
PYBB_DEFAULT_MARKUP = 'markdown'
128
193
PYBB_FREEZE_FIRST_POST = False
129
194
 
131
196
# Link classification and other Markup stuff #
132
197
##############################################
133
198
LOCAL_DOMAINS = [
134
 
    "xoops.widelands.org"
 
199
    'xoops.widelands.org'
135
200
]
136
 
SMILEY_DIR = MEDIA_URL + "img/smileys/"
 
201
 
 
202
SMILEY_DIR = MEDIA_URL + 'img/smileys/'
137
203
# Keep this list ordered by length of smileys
138
204
SMILEYS = [
139
 
    ("O:-)", "face-angel.png"),
140
 
    ("O:)", "face-angel.png"),
141
 
    (":-/", "face-confused.png"),
142
 
    (":/", "face-confused.png"),
143
 
    ("B-)", "face-cool.png"),
144
 
    ("B)", "face-cool.png"),
145
 
    (":'-(", "face-crying.png"),
146
 
    (":'(", "face-crying.png"),
147
 
    (":-))", "face-smile-big.png"),
148
 
    (":))", "face-smile-big.png"),
149
 
    (":-)", "face-smile.png"),
150
 
    (":)", "face-smile.png"),
151
 
    (">:-)", "face-devilish.png"), # Hack around markdown replacement. see also SMILEY_PREESCAPING
152
 
    ("8-)", "face-glasses.png"),
153
 
    ("8)", "face-glasses.png"),
154
 
    (":-D", "face-grin.png"),
155
 
    (":D", "face-grin.png"),
156
 
    (":-x", "face-kiss.png"),
157
 
    (":x", "face-kiss.png"),
158
 
    (":-*", "face-kiss.png"),
159
 
    (":*", "face-kiss.png"),
160
 
    (":-((", "face-mad.png"),
161
 
    (":((", "face-mad.png"),
162
 
    (":-||", "face-mad.png"),
163
 
    (":||", "face-mad.png"),
164
 
    (":(|)", "face-monkey.png"),
165
 
    (":-|", "face-plain.png"),
166
 
    (":|", "face-plain.png"),
167
 
    (":-(", "face-sad.png"),
168
 
    (":(", "face-sad.png"),
169
 
    (":-O", "face-shock.png"),
170
 
    (":O", "face-shock.png"),
171
 
    (":-o", "face-surprise.png"),
172
 
    (":o", "face-surprise.png"),
173
 
    (":-P", "face-tongue.png"),
174
 
    (":P", "face-tongue.png"),
175
 
    (":-S", "face-upset.png"),
176
 
    (":S", "face-upset.png"),
177
 
    (";-)", "face-wink.png"),
178
 
    (";)", "face-wink.png"),
 
205
    ('O:-)', 'face-angel.png'),
 
206
    ('O:)', 'face-angel.png'),
 
207
    (':-/', 'face-confused.png'),
 
208
    (':/', 'face-confused.png'),
 
209
    ('B-)', 'face-cool.png'),
 
210
    ('B)', 'face-cool.png'),
 
211
    (":'-(", 'face-crying.png'),
 
212
    (":'(", 'face-crying.png'),
 
213
    (':-))', 'face-smile-big.png'),
 
214
    (':))', 'face-smile-big.png'),
 
215
    (':-)', 'face-smile.png'),
 
216
    (':)', 'face-smile.png'),
 
217
    # Hack around markdown replacement. see also SMILEY_PREESCAPING
 
218
    ('>:-)', 'face-devilish.png'),
 
219
    ('8-)', 'face-glasses.png'),
 
220
    ('8)', 'face-glasses.png'),
 
221
    (':-D', 'face-grin.png'),
 
222
    (':D', 'face-grin.png'),
 
223
    (':-x', 'face-kiss.png'),
 
224
    (':x', 'face-kiss.png'),
 
225
    (':-*', 'face-kiss.png'),
 
226
    (':*', 'face-kiss.png'),
 
227
    (':-((', 'face-mad.png'),
 
228
    (':((', 'face-mad.png'),
 
229
    (':-||', 'face-mad.png'),
 
230
    (':||', 'face-mad.png'),
 
231
    (':(|)', 'face-monkey.png'),
 
232
    (':-|', 'face-plain.png'),
 
233
    (':|', 'face-plain.png'),
 
234
    (':-(', 'face-sad.png'),
 
235
    (':(', 'face-sad.png'),
 
236
    (':-O', 'face-shock.png'),
 
237
    (':O', 'face-shock.png'),
 
238
    (':-o', 'face-surprise.png'),
 
239
    (':o', 'face-surprise.png'),
 
240
    (':-P', 'face-tongue.png'),
 
241
    (':P', 'face-tongue.png'),
 
242
    (':-S', 'face-upset.png'),
 
243
    (':S', 'face-upset.png'),
 
244
    (';-)', 'face-wink.png'),
 
245
    (';)', 'face-wink.png'),
179
246
]
180
247
# This needs to be done to keep some stuff hidden from markdown
181
248
SMILEY_PREESCAPING = [
182
 
    (">:-)", "\>:-)")
 
249
    ('>:-)', '\>:-)')
183
250
]
184
251
 
185
252
###############################
186
253
# Sphinx (Search prog) Config #
187
254
###############################
188
 
USE_SPHINX=False
 
255
USE_SPHINX = True
189
256
SPHINX_API_VERSION = 0x116
190
257
 
191
258
############
192
259
# Tracking #
193
260
############
194
 
TRACKING_CLEANUP_TIMEOUT=48
 
261
TRACKING_CLEANUP_TIMEOUT = 48
195
262
 
196
263
###########################
197
264
# Widelands SVN directory #
199
266
# This is needed for various thinks, for example
200
267
# to access media (for minimap creation) or for online help
201
268
# or for ChangeLog displays
202
 
WIDELANDS_SVN_DIR=""
 
269
WIDELANDS_SVN_DIR = ''
203
270
 
204
271
#####################
205
272
# ChangeLog display #
206
273
#####################
207
 
BZR_URL = r"http://bazaar.launchpad.net/%%7Ewidelands-dev/widelands/trunk/revision/%s"
 
274
# NOCOMM franku: This is only used in mainpage/wl_markdown/templatetags/wl_markdon.py/_insert_revision()
 
275
# Since there is a plan to have only some prosa in the Changelog, both (this setting and the function)
 
276
# could be removed. It didn't worked either...
 
277
BZR_URL = r'http://bazaar.launchpad.net/~widelands-dev/widelands/trunk/revision/%s'
208
278
 
209
279
###############
210
280
# Screenshots #
211
281
###############
212
 
THUMBNAIL_SIZE = ( 160, 160 )
 
282
THUMBNAIL_SIZE = (160, 160)
213
283
 
214
284
########
215
285
# Maps #
216
286
########
217
287
MAPS_PER_PAGE = 10
218
288
 
219
 
INSTALLED_APPS = (
220
 
    'django.contrib.auth',
221
 
    'django.contrib.contenttypes',
222
 
    'django.contrib.sessions',
223
 
    'django.contrib.sites',
224
 
    'django.contrib.admin',
225
 
    'django.contrib.markup',
226
 
    'django.contrib.humanize',
227
 
 
228
 
    # TODO: only temporary for webdesign stuff
229
 
    'django.contrib.webdesign',
230
 
 
231
 
    # Thirdparty apps, but need preload
232
 
    'tracking',
233
 
 
234
 
    # Our own apps
235
 
    'widelands.mainpage',
236
 
    'widelands.wlhelp',
237
 
    'widelands.wlimages',
238
 
    'widelands.wlwebchat',
239
 
    'widelands.wlrecaptcha',
240
 
    'widelands.wlprofile',
241
 
    'widelands.wlsearch',
242
 
    'widelands.wlpoll',
243
 
    'widelands.wlevents',
244
 
    'widelands.wlmaps',
245
 
    'widelands.wlscreens',
246
 
    'widelands.wlggz',
247
 
 
248
 
    # Modified 3rd party apps
249
 
    'widelands.wiki', # This is based on wikiapp, but has some local modifications
250
 
    'widelands.news', # This is based on simple-blog, but has some local modifications
251
 
    'pybb', # Feature enriched version of pybb
252
 
 
253
 
    # Thirdparty apps
254
 
    'threadedcomments',
255
 
    'django_messages',
256
 
    'registration', # User registration (per Email validation)
257
 
    'pagination',
258
 
    'tagging',
259
 
    'notification',
260
 
    'djangoratings',
261
 
    'sphinxdoc',
262
 
    'south',
263
 
)
264
 
 
265
 
USE_GOOGLE_ANALYTICS=False
 
289
 
 
290
USE_GOOGLE_ANALYTICS = False
266
291
 
267
292
##############################################
268
293
## Recipient(s) who get an email if someone ##
269
 
##       uses the on legal notice page      ##
 
294
## uses the form on legal notice page       ##
270
295
## Use allways the form ('name', 'Email')   ##
271
296
##############################################
272
 
INQUIRY_RECIPIENTS = (
273
 
   ('franku','somal@arcor.de'),
274
 
)
 
297
INQUIRY_RECIPIENTS = [
 
298
    ('peter', 'peter@example.com'),
 
299
]
 
300
 
 
301
##########################################
 
302
## Allowed tags/attributes for 'bleach' ##
 
303
## Used for sanitizing user input.      ##
 
304
##########################################
 
305
BLEACH_ALLOWED_TAGS = [u'a',
 
306
                       u'abbr',
 
307
                       u'acronym',
 
308
                       u'blockquote',
 
309
                       u'br',
 
310
                       u'em',  u'i',  u'strong', u'b',
 
311
                       u'ul',  u'ol', u'li',
 
312
                       u'div', u'p',
 
313
                       u'h1',  u'h2', u'h3', u'h4', u'h5', u'h6',
 
314
                       u'pre', u'code',
 
315
                       u'img',
 
316
                       u'hr',
 
317
                       u'table', u'tbody', u'thead', u'th', u'tr', u'td',
 
318
                       u'sup',
 
319
]
 
320
 
 
321
BLEACH_ALLOWED_ATTRIBUTES = {'img': ['src', 'alt'], 'a': ['href'], '*': ['class', 'id', 'title']}
275
322
 
276
323
try:
277
 
    from local_settings import *
 
324
   from local_settings import *
278
325
except ImportError:
279
 
    pass
 
326
   pass
280
327
 
281
328
if USE_SPHINX:
282
 
    INSTALLED_APPS += (
283
 
        'djangosphinx',
284
 
    )
 
329
   INSTALLED_APPS += (
 
330
       'djangosphinx',
 
331
   )