~widelands-dev/widelands-website/django_staticfiles

« back to all changes in this revision

Viewing changes to settings.py

  • Committer: Holger Rapp
  • Date: 2009-02-20 12:25:18 UTC
  • Revision ID: holgerrapp@gmx.net-20090220122518-feaq34ta973snnct
Imported wikiapp into our repository, because we did some local changes (users must be logged in to edit wiki pages)

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.abspath(__file__))
7
3
DEBUG = True
 
4
TEMPLATE_DEBUG = DEBUG
8
5
 
9
6
ADMINS = (
10
7
    # ('Your Name', 'your_email@domain.com'),
12
9
 
13
10
MANAGERS = ADMINS
14
11
 
15
 
DATABASES = {
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
 
    }
26
 
}
 
12
DATABASE_ENGINE = 'sqlite3'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
 
13
DATABASE_NAME = 'dev.db'             # Or path to database file if using sqlite3.
 
14
DATABASE_USER = ''             # Not used with sqlite3.
 
15
DATABASE_PASSWORD = ''         # Not used with sqlite3.
 
16
DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
 
17
DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.
27
18
 
28
19
# Local time zone for this installation. Choices can be found here:
29
20
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
31
22
# If running in a Windows environment this must be set to the same as your
32
23
# system time zone.
33
24
TIME_ZONE = 'Europe/Berlin'
34
 
USE_TZ = False  # See https://docs.djangoproject.com/en/1.8/ref/settings/#std:setting-TIME_ZONE
35
25
 
36
26
# Language code for this installation. All choices can be found here:
37
27
# http://www.i18nguy.com/unicode/language-identifiers.html
38
 
LANGUAGE_CODE = 'en'
 
28
LANGUAGE_CODE = 'de'
39
29
 
40
30
SITE_ID = 1
41
31
 
42
 
# Where should logged in user go by default?
43
 
LOGIN_REDIRECT_URL = '/'
44
 
 
45
32
# If you set this to False, Django will make some optimizations so as not
46
33
# to load the internationalization machinery.
47
 
USE_I18N = False
 
34
USE_I18N = True
48
35
 
49
36
# Absolute path to the directory that holds media.
50
37
# Example: "/home/media/media.lawrence.com/"
51
 
# Overwritten in local_settings.py
52
38
MEDIA_ROOT = ''
53
39
 
54
40
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
55
41
# trailing slash if there is a path component (optional in other cases).
56
42
# Examples: "http://media.lawrence.com", "http://example.com/media/"
57
 
MEDIA_URL = '/wlmedia/'
58
 
 
59
 
# Absolute path where static files from thirdparty apps will be collected using
60
 
# the command: ./manage.py collectstatic
61
 
STATIC_ROOT = os.path.join(BASE_DIR, 'media/static_collected/')
62
 
 
63
 
# URL to use when referring to static files located in STATIC_ROOT.
64
 
# Must be different than MEDIA_URL!
65
 
# https://docs.djangoproject.com/en/1.8/howto/static-files/
66
 
STATIC_URL = '/static/'
 
43
MEDIA_URL = ''
 
44
 
 
45
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
 
46
# trailing slash.
 
47
# Examples: "http://foo.com/media/", "/media/".
 
48
ADMIN_MEDIA_PREFIX = '/media/'
67
49
 
68
50
# Make this unique, and don't share it with anybody.
69
51
SECRET_KEY = '#*bc7*q0-br42fc&6l^x@zzk&(=-#gr!)fn@t30n54n05jkqcu'
70
52
 
71
 
ROOT_URLCONF = 'urls'
72
 
 
73
 
# List of finder classes that know how to find static files in
74
 
# various locations.
75
 
STATICFILES_FINDERS = [
76
 
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
77
 
]
78
 
 
79
 
INSTALLED_APPS = [
80
 
    'django.contrib.admin',
 
53
# List of callables that know how to import templates from various sources.
 
54
TEMPLATE_LOADERS = (
 
55
    'django.template.loaders.filesystem.load_template_source',
 
56
    'django.template.loaders.app_directories.load_template_source',
 
57
#     'django.template.loaders.eggs.load_template_source',
 
58
)
 
59
 
 
60
MIDDLEWARE_CLASSES = (
 
61
    'django.middleware.common.CommonMiddleware',
 
62
    'django.contrib.sessions.middleware.SessionMiddleware',
 
63
    'django.contrib.auth.middleware.AuthenticationMiddleware',
 
64
    'pagination.middleware.PaginationMiddleware',
 
65
)
 
66
 
 
67
ROOT_URLCONF = 'widelands.urls'
 
68
 
 
69
TEMPLATE_DIRS = (
 
70
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
 
71
    # Always use forward slashes, even on Windows.
 
72
    # Don't forget to use absolute paths, not relative paths.
 
73
    '/var/www/django_projects/widelands/templates',
 
74
)
 
75
 
 
76
TEMPLATE_CONTEXT_PROCESSORS = (
 
77
    "django.core.context_processors.auth",
 
78
    "django.core.context_processors.debug",
 
79
    "django.core.context_processors.i18n",
 
80
    "django.core.context_processors.media",
 
81
    'django.core.context_processors.request',
 
82
)
 
83
 
 
84
############################
 
85
# Activation configuration #
 
86
############################
 
87
DEFAULT_FROM_EMAIL = 'noreply@widelands.org'
 
88
ACCOUNT_ACTIVATION_DAYS=2 # Days an activation token keeps active
 
89
 
 
90
######################
 
91
# Wiki configuration #
 
92
######################
 
93
WIKI_LOCK_DURATION = 30
 
94
 
 
95
 
 
96
INSTALLED_APPS = (
81
97
    'django.contrib.auth',
82
98
    'django.contrib.contenttypes',
83
99
    'django.contrib.sessions',
84
 
    'django.contrib.messages',
85
 
    'django.contrib.staticfiles',
86
100
    'django.contrib.sites',
87
 
    'django.contrib.humanize',
88
 
    'django.contrib.sitemaps',
89
 
    'nocaptcha_recaptcha',
 
101
    'django.contrib.admin',
 
102
    'django.contrib.markup',
 
103
 
 
104
    # TODO: only temporary for webdesign stuff
 
105
    'django.contrib.webdesign',
90
106
 
91
107
    # Our own apps
92
 
    'wiki.templatetags.restructuredtext',
93
 
    'mainpage',
94
 
    'wlhelp',
95
 
    'wlimages',
96
 
    'wlwebchat',
97
 
    'wlprofile',
98
 
    'wlsearch',
99
 
    'wlpoll',
100
 
    'wlevents',
101
 
    'wlmaps.apps.WlMapsConfig',
102
 
    'wlscreens',
103
 
    'wlggz',
104
 
    'wlscheduling',
105
 
    'check_input.apps.CheckInput',
106
 
    'documentation',
107
 
    'privacy_policy.apps.PrivacyPolicyConfig',
108
 
    'haystack', # search engine; see option HAYSTACK_CONNECTIONS
109
 
 
110
 
    # Modified 3rd party apps
111
 
    'wiki.apps.WikiConfig',  # This is based on wikiapp, but has some local modifications
112
 
    'news',  # This is based on simple-blog, but has some local modifications
113
 
    'pybb.apps.PybbConfig',  # Feature enriched version of pybb
 
108
    'widelands.mainpage',
 
109
    'widelands.wiki', # This is based on wikiapp, but has some local modifications
114
110
 
115
111
    # Thirdparty apps
116
 
    'threadedcomments',  # included as wlapp
117
 
    'notification',     # included as wlapp
118
 
    'django_messages_wl.apps.WLDjangoMessagesConfig',
119
 
    'dj_pagination',
 
112
    'registration', # User registration (per Email validation)
 
113
    'pagination',
120
114
    'tagging',
121
 
    'star_ratings',
122
 
]
123
 
 
124
 
MIDDLEWARE = [
125
 
    'django.middleware.security.SecurityMiddleware',
126
 
    'django.contrib.sessions.middleware.SessionMiddleware',
127
 
    'django.middleware.common.CommonMiddleware',
128
 
    'django.middleware.csrf.CsrfViewMiddleware',
129
 
    'django.contrib.auth.middleware.AuthenticationMiddleware',
130
 
    'django.contrib.messages.middleware.MessageMiddleware',
131
 
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
132
 
    
133
 
    # Foreign middleware
134
 
    'dj_pagination.middleware.PaginationMiddleware',
135
 
    'online_users_middleware.OnlineNowMiddleware',
136
 
]
137
 
 
138
 
TEMPLATES = [
139
 
    {
140
 
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
141
 
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
142
 
        'APP_DIRS': True,
143
 
        'OPTIONS': {
144
 
            'context_processors': [
145
 
                'django.template.context_processors.debug',
146
 
                'django.template.context_processors.request',
147
 
                'django.contrib.auth.context_processors.auth',
148
 
                'django.contrib.messages.context_processors.messages',
149
 
                'django.template.context_processors.i18n',
150
 
                'django.template.context_processors.media',
151
 
                'django.template.context_processors.static',
152
 
                'django.template.context_processors.tz',
153
 
                'django_messages.context_processors.inbox',
154
 
                'wlprofile.context_processors.deleted_user_data',
155
 
            ],
156
 
        },
157
 
    },
158
 
]
159
 
 
160
 
############################
161
 
# Activation configuration #
162
 
############################
163
 
DEFAULT_FROM_EMAIL = 'noreply@widelands.org'
164
 
ACCOUNT_ACTIVATION_DAYS = 2  # Days an activation token keeps active
165
 
 
166
 
# Franku: SHA1 Needed as compatibility for old passwords
167
 
# https://docs.djangoproject.com/en/1.11/releases/1.10/#removed-weak-password-hashers-from-the-default-password-hashers-setting
168
 
PASSWORD_HASHERS = [
169
 
    'django.contrib.auth.hashers.PBKDF2PasswordHasher',
170
 
    'django.contrib.auth.hashers.SHA1PasswordHasher'
171
 
]
172
 
 
173
 
######################
174
 
# Wiki configuration #
175
 
######################
176
 
WIKI_LOCK_DURATION = 30
177
 
WIKI_URL_RE = r'[:\-\w ]+'
178
 
WIKI_WORD_RE = r'[:\-\w ]+'
179
 
 
180
 
######################
181
 
# User configuration #
182
 
######################
183
 
DEFAULT_TIME_ZONE = 3  # See wlprofile.templatetags.custom_date
184
 
DEFAULT_TIME_DISPLAY = r"%ND(Y-m-d,) H:i"  # According to ISO 8601
185
 
DEFAULT_MARKUP = 'markdown'
186
 
SIGNATURE_MAX_LENGTH = 255
187
 
SIGNATURE_MAX_LINES = 8
188
 
AVATARS_UPLOAD_TO = 'profile/avatars'
189
 
AVATAR_HEIGHT = AVATAR_WIDTH = 80
190
 
 
191
 
######################
192
 
# Pybb Configuration #
193
 
######################
194
 
PYBB_ATTACHMENT_ENABLE = False  # disable gzip middleware when enabling attachments
195
 
PYBB_DEFAULT_MARKUP = 'markdown'
196
 
PYBB_FREEZE_FIRST_POST = False
197
 
 
198
 
##############################################
199
 
# Link classification and other Markup stuff #
200
 
##############################################
201
 
LOCAL_DOMAINS = [
202
 
    'xoops.widelands.org'
203
 
]
204
 
 
205
 
SMILEY_DIR = STATIC_URL + 'img/smileys/'
206
 
# Keep this list ordered by length of smileys
207
 
SMILEYS = [
208
 
    ('O:-)', 'face-angel.png'),
209
 
    ('O:)', 'face-angel.png'),
210
 
    (':-/', 'face-confused.png'),
211
 
    (':/', 'face-confused.png'),
212
 
    ('B-)', 'face-cool.png'),
213
 
    ('B)', 'face-cool.png'),
214
 
    (":'-(", 'face-crying.png'),
215
 
    (":'(", 'face-crying.png'),
216
 
    (':-))', 'face-smile-big.png'),
217
 
    (':))', 'face-smile-big.png'),
218
 
    (':-)', 'face-smile.png'),
219
 
    (':)', 'face-smile.png'),
220
 
    (']:-)', 'face-devilish.png'),
221
 
    ('8-)', 'face-glasses.png'),
222
 
    ('8)', 'face-glasses.png'),
223
 
    (':-D', 'face-grin.png'),
224
 
    (':D', 'face-grin.png'),
225
 
    (':-x', 'face-kiss.png'),
226
 
    (':x', 'face-kiss.png'),
227
 
    (':-*', 'face-kiss.png'),
228
 
    (':*', 'face-kiss.png'),
229
 
    (':-((', 'face-mad.png'),
230
 
    (':((', 'face-mad.png'),
231
 
    (':-||', 'face-mad.png'),
232
 
    (':||', 'face-mad.png'),
233
 
    (':(|)', 'face-monkey.png'),
234
 
    (':-|', 'face-plain.png'),
235
 
    (':|', 'face-plain.png'),
236
 
    (':-(', 'face-sad.png'),
237
 
    (':(', 'face-sad.png'),
238
 
    (':-O', 'face-shock.png'),
239
 
    (':O', 'face-shock.png'),
240
 
    (':-o', 'face-surprise.png'),
241
 
    (':o', 'face-surprise.png'),
242
 
    (':-P', 'face-tongue.png'),
243
 
    (':P', 'face-tongue.png'),
244
 
    (':-S', 'face-upset.png'),
245
 
    (':S', 'face-upset.png'),
246
 
    (';-)', 'face-wink.png'),
247
 
    (';)', 'face-wink.png'),
248
 
]
249
 
 
250
 
#################
251
 
# Search Config #
252
 
#################
253
 
HAYSTACK_CONNECTIONS = {
254
 
    'default': {
255
 
        'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
256
 
        'PATH': os.path.join(os.path.dirname(__file__), 'whoosh_index'),
257
 
    },
258
 
}
259
 
 
260
 
###########################
261
 
# Widelands SVN directory #
262
 
###########################
263
 
# This is needed for various thinks, for example
264
 
# to access media (for minimap creation) or for online help
265
 
# or for ChangeLog displays
266
 
WIDELANDS_SVN_DIR = ''
267
 
 
268
 
###############
269
 
# Screenshots #
270
 
###############
271
 
THUMBNAIL_SIZE = (160, 160)
272
 
 
273
 
########
274
 
# Maps #
275
 
########
276
 
MAPS_PER_PAGE = 10
277
 
 
278
 
##############################################
279
 
## Recipient(s) who get an email if someone ##
280
 
## uses the form on legal notice page       ##
281
 
## Use allways the form ('name', 'Email')   ##
282
 
##############################################
283
 
INQUIRY_RECIPIENTS = [
284
 
    ('peter', 'peter@example.com'),
285
 
]
286
 
 
287
 
##########################################
288
 
## Allowed tags/attributes for 'bleach' ##
289
 
## Used for sanitizing user input.      ##
290
 
##########################################
291
 
BLEACH_ALLOWED_TAGS = [u'a',
292
 
                       u'abbr',
293
 
                       u'acronym',
294
 
                       u'blockquote',
295
 
                       u'br',
296
 
                       u'em',  u'i',  u'strong', u'b',
297
 
                       u'ul',  u'ol', u'li',
298
 
                       u'div', u'p',
299
 
                       u'h1',  u'h2', u'h3', u'h4', u'h5', u'h6',
300
 
                       u'pre', u'code',
301
 
                       u'img',
302
 
                       u'hr',
303
 
                       u'table', u'tbody', u'thead', u'th', u'tr', u'td',
304
 
                       u'sup',
305
 
                       ]
306
 
 
307
 
BLEACH_ALLOWED_ATTRIBUTES = {'img': ['src', 'alt'], 'a': [
308
 
    'href'], 'td': ['align'], '*': ['class', 'id', 'title']}
309
 
 
310
 
##########################
311
 
# Pagination settings    #
312
 
# for dj-pagination      #
313
 
##########################
314
 
PAGINATION_DEFAULT_WINDOW = 2
315
 
 
316
 
###########################
317
 
# Settings for displaying #
318
 
# online users            #
319
 
###########################
320
 
 
321
 
# Time in seconds how long a user will be shown online
322
 
ONLINE_THRESHOLD = 60 * 15
323
 
# Number of stored users
324
 
ONLINE_MAX = 25
325
 
 
326
 
###########################################
327
 
# Settings for users who deleted themself #
328
 
###########################################
329
 
 
330
 
DELETED_MAIL_ADDRESS = ''
331
 
DELETED_USERNAME = 'Ex-Member'
332
 
 
333
 
###################
334
 
# Cookie settings #
335
 
###################
336
 
 
337
 
# See: https://docs.djangoproject.com/en/dev/ref/settings/#csrf-cookie-age
338
 
CSRF_COOKIE_AGE = None
339
 
 
340
 
#############################
341
 
# star_rating configuration #
342
 
#############################
343
 
 
344
 
STAR_RATINGS_STAR_HEIGHT = 14
345
 
STAR_RATINGS_STAR_WIDTH = 14
346
 
STAR_RATINGS_RANGE = 10
 
115
)
347
116
 
348
117
try:
349
118
    from local_settings import *