~widelands-dev/widelands-website/django_staticfiles

« back to all changes in this revision

Viewing changes to settings.py

  • Committer: Holger Rapp
  • Date: 2009-02-19 15:31:42 UTC
  • Revision ID: sirver@h566336-20090219153142-dc8xuabldnw5t395
Initial commit of new widelands homepage

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
 
# Absoltute 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_foreign/')
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.FileSystemFinder',
77
 
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
78
 
]
79
 
 
80
 
INSTALLED_APPS = [
81
 
    '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
)
 
65
 
 
66
ROOT_URLCONF = 'widelands.urls'
 
67
 
 
68
TEMPLATE_DIRS = (
 
69
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
 
70
    # Always use forward slashes, even on Windows.
 
71
    # Don't forget to use absolute paths, not relative paths.
 
72
    '/var/www/django_projects/widelands/templates',
 
73
)
 
74
 
 
75
INSTALLED_APPS = (
82
76
    'django.contrib.auth',
83
77
    'django.contrib.contenttypes',
84
78
    'django.contrib.sessions',
85
 
    'django.contrib.messages',
86
 
    'django.contrib.staticfiles',
87
79
    'django.contrib.sites',
88
 
    'django.contrib.humanize',
89
 
    'django.contrib.sitemaps',
90
 
    'nocaptcha_recaptcha',
91
 
 
 
80
    'django.contrib.admin',
 
81
    
92
82
    # Our own apps
93
 
    'wiki.templatetags.restructuredtext',
94
 
    'mainpage',
95
 
    'wlhelp',
96
 
    'wlimages',
97
 
    'wlwebchat',
98
 
    'wlprofile',
99
 
    'wlsearch',
100
 
    'wlpoll',
101
 
    'wlevents',
102
 
    'wlmaps.apps.WlMapsConfig',
103
 
    'wlscreens',
104
 
    'wlggz',
105
 
    'wlscheduling',
106
 
    'check_input.apps.CheckInput',
107
 
    'documentation',
108
 
    'privacy_policy.apps.PrivacyPolicyConfig',
109
 
    'haystack', # search engine; see option HAYSTACK_CONNECTIONS
110
 
 
111
 
    # Modified 3rd party apps
112
 
    'wiki.apps.WikiConfig',  # This is based on wikiapp, but has some local modifications
113
 
    'news',  # This is based on simple-blog, but has some local modifications
114
 
    'news.managers',
115
 
    'pybb.apps.PybbConfig',  # Feature enriched version of pybb
 
83
    'widelands.mainpage',
116
84
 
117
85
    # Thirdparty apps
118
 
    'threadedcomments',  # included as wlapp
119
 
    'notification',     # included as wlapp
120
 
    'django_messages_wl.apps.WLDjangoMessagesConfig',
121
 
    'dj_pagination',
122
86
    'tagging',
123
 
    'star_ratings',
124
 
]
125
 
 
126
 
MIDDLEWARE = [
127
 
    'django.middleware.security.SecurityMiddleware',
128
 
    'django.contrib.sessions.middleware.SessionMiddleware',
129
 
    'django.middleware.common.CommonMiddleware',
130
 
    'django.middleware.csrf.CsrfViewMiddleware',
131
 
    'django.contrib.auth.middleware.AuthenticationMiddleware',
132
 
    'django.contrib.messages.middleware.MessageMiddleware',
133
 
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
134
 
    
135
 
    # Foreign middleware
136
 
    'dj_pagination.middleware.PaginationMiddleware',
137
 
    'online_users_middleware.OnlineNowMiddleware',
138
 
]
139
 
 
140
 
TEMPLATES = [
141
 
    {
142
 
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
143
 
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
144
 
        'APP_DIRS': True,
145
 
        'OPTIONS': {
146
 
            'context_processors': [
147
 
                'django.template.context_processors.debug',
148
 
                'django.template.context_processors.request',
149
 
                'django.contrib.auth.context_processors.auth',
150
 
                'django.contrib.messages.context_processors.messages',
151
 
                'django.template.context_processors.i18n',
152
 
                'django.template.context_processors.media',
153
 
                'django.template.context_processors.static',
154
 
                'django.template.context_processors.tz',
155
 
                'django_messages.context_processors.inbox',
156
 
                'wlprofile.context_processors.deleted_user_data',
157
 
            ],
158
 
        },
159
 
    },
160
 
]
161
 
 
162
 
############################
163
 
# Activation configuration #
164
 
############################
165
 
DEFAULT_FROM_EMAIL = 'noreply@widelands.org'
166
 
ACCOUNT_ACTIVATION_DAYS = 2  # Days an activation token keeps active
167
 
 
168
 
# Franku: SHA1 Needed as compatibility for old passwords
169
 
# https://docs.djangoproject.com/en/1.11/releases/1.10/#removed-weak-password-hashers-from-the-default-password-hashers-setting
170
 
PASSWORD_HASHERS = [
171
 
    'django.contrib.auth.hashers.PBKDF2PasswordHasher',
172
 
    'django.contrib.auth.hashers.SHA1PasswordHasher'
173
 
]
174
 
 
175
 
######################
176
 
# Wiki configuration #
177
 
######################
178
 
WIKI_LOCK_DURATION = 30
179
 
WIKI_URL_RE = r'[:\-\w ]+'
180
 
WIKI_WORD_RE = r'[:\-\w ]+'
181
 
 
182
 
######################
183
 
# User configuration #
184
 
######################
185
 
DEFAULT_TIME_ZONE = 3  # See wlprofile.templatetags.custom_date
186
 
DEFAULT_TIME_DISPLAY = r"%ND(Y-m-d,) H:i"  # According to ISO 8601
187
 
DEFAULT_MARKUP = 'markdown'
188
 
SIGNATURE_MAX_LENGTH = 255
189
 
SIGNATURE_MAX_LINES = 8
190
 
AVATARS_UPLOAD_TO = 'profile/avatars'
191
 
AVATAR_HEIGHT = AVATAR_WIDTH = 80
192
 
 
193
 
######################
194
 
# Pybb Configuration #
195
 
######################
196
 
PYBB_ATTACHMENT_ENABLE = False  # disable gzip middleware when enabling attachments
197
 
PYBB_DEFAULT_MARKUP = 'markdown'
198
 
PYBB_FREEZE_FIRST_POST = False
199
 
 
200
 
##############################################
201
 
# Link classification and other Markup stuff #
202
 
##############################################
203
 
LOCAL_DOMAINS = [
204
 
    'xoops.widelands.org'
205
 
]
206
 
 
207
 
SMILEY_DIR = MEDIA_URL + 'img/smileys/'
208
 
# Keep this list ordered by length of smileys
209
 
SMILEYS = [
210
 
    ('O:-)', 'face-angel.png'),
211
 
    ('O:)', 'face-angel.png'),
212
 
    (':-/', 'face-confused.png'),
213
 
    (':/', 'face-confused.png'),
214
 
    ('B-)', 'face-cool.png'),
215
 
    ('B)', 'face-cool.png'),
216
 
    (":'-(", 'face-crying.png'),
217
 
    (":'(", 'face-crying.png'),
218
 
    (':-))', 'face-smile-big.png'),
219
 
    (':))', 'face-smile-big.png'),
220
 
    (':-)', 'face-smile.png'),
221
 
    (':)', 'face-smile.png'),
222
 
    (']:-)', 'face-devilish.png'),
223
 
    ('8-)', 'face-glasses.png'),
224
 
    ('8)', 'face-glasses.png'),
225
 
    (':-D', 'face-grin.png'),
226
 
    (':D', 'face-grin.png'),
227
 
    (':-x', 'face-kiss.png'),
228
 
    (':x', 'face-kiss.png'),
229
 
    (':-*', 'face-kiss.png'),
230
 
    (':*', 'face-kiss.png'),
231
 
    (':-((', 'face-mad.png'),
232
 
    (':((', 'face-mad.png'),
233
 
    (':-||', 'face-mad.png'),
234
 
    (':||', 'face-mad.png'),
235
 
    (':(|)', 'face-monkey.png'),
236
 
    (':-|', 'face-plain.png'),
237
 
    (':|', 'face-plain.png'),
238
 
    (':-(', 'face-sad.png'),
239
 
    (':(', 'face-sad.png'),
240
 
    (':-O', 'face-shock.png'),
241
 
    (':O', 'face-shock.png'),
242
 
    (':-o', 'face-surprise.png'),
243
 
    (':o', 'face-surprise.png'),
244
 
    (':-P', 'face-tongue.png'),
245
 
    (':P', 'face-tongue.png'),
246
 
    (':-S', 'face-upset.png'),
247
 
    (':S', 'face-upset.png'),
248
 
    (';-)', 'face-wink.png'),
249
 
    (';)', 'face-wink.png'),
250
 
]
251
 
 
252
 
#################
253
 
# Search Config #
254
 
#################
255
 
HAYSTACK_CONNECTIONS = {
256
 
    'default': {
257
 
        'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
258
 
        'PATH': os.path.join(os.path.dirname(__file__), 'whoosh_index'),
259
 
    },
260
 
}
261
 
 
262
 
###########################
263
 
# Widelands SVN directory #
264
 
###########################
265
 
# This is needed for various thinks, for example
266
 
# to access media (for minimap creation) or for online help
267
 
# or for ChangeLog displays
268
 
WIDELANDS_SVN_DIR = ''
269
 
 
270
 
###############
271
 
# Screenshots #
272
 
###############
273
 
THUMBNAIL_SIZE = (160, 160)
274
 
 
275
 
########
276
 
# Maps #
277
 
########
278
 
MAPS_PER_PAGE = 10
279
 
 
280
 
##############################################
281
 
## Recipient(s) who get an email if someone ##
282
 
## uses the form on legal notice page       ##
283
 
## Use allways the form ('name', 'Email')   ##
284
 
##############################################
285
 
INQUIRY_RECIPIENTS = [
286
 
    ('peter', 'peter@example.com'),
287
 
]
288
 
 
289
 
##########################################
290
 
## Allowed tags/attributes for 'bleach' ##
291
 
## Used for sanitizing user input.      ##
292
 
##########################################
293
 
BLEACH_ALLOWED_TAGS = [u'a',
294
 
                       u'abbr',
295
 
                       u'acronym',
296
 
                       u'blockquote',
297
 
                       u'br',
298
 
                       u'em',  u'i',  u'strong', u'b',
299
 
                       u'ul',  u'ol', u'li',
300
 
                       u'div', u'p',
301
 
                       u'h1',  u'h2', u'h3', u'h4', u'h5', u'h6',
302
 
                       u'pre', u'code',
303
 
                       u'img',
304
 
                       u'hr',
305
 
                       u'table', u'tbody', u'thead', u'th', u'tr', u'td',
306
 
                       u'sup',
307
 
                       ]
308
 
 
309
 
BLEACH_ALLOWED_ATTRIBUTES = {'img': ['src', 'alt'], 'a': [
310
 
    'href'], 'td': ['align'], '*': ['class', 'id', 'title']}
311
 
 
312
 
##########################
313
 
# Pagination settings    #
314
 
# for dj-pagination      #
315
 
##########################
316
 
PAGINATION_DEFAULT_WINDOW = 2
317
 
 
318
 
###########################
319
 
# Settings for displaying #
320
 
# online users            #
321
 
###########################
322
 
 
323
 
# Time in seconds how long a user will be shown online
324
 
ONLINE_THRESHOLD = 60 * 15
325
 
# Number of stored users
326
 
ONLINE_MAX = 25
327
 
 
328
 
###########################################
329
 
# Settings for users who deleted themself #
330
 
###########################################
331
 
 
332
 
DELETED_MAIL_ADDRESS = ''
333
 
DELETED_USERNAME = 'Ex-Member'
334
 
 
335
 
###################
336
 
# Cookie settings #
337
 
###################
338
 
 
339
 
# See: https://docs.djangoproject.com/en/dev/ref/settings/#csrf-cookie-age
340
 
CSRF_COOKIE_AGE = None
341
 
 
342
 
#############################
343
 
# star_rating configuration #
344
 
#############################
345
 
 
346
 
STAR_RATINGS_STAR_HEIGHT = 14
347
 
STAR_RATINGS_STAR_WIDTH = 14
348
 
STAR_RATINGS_RANGE = 10
 
87
    'wiki',
 
88
)
349
89
 
350
90
try:
351
91
    from local_settings import *