-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbase.py
More file actions
262 lines (213 loc) · 7.12 KB
/
base.py
File metadata and controls
262 lines (213 loc) · 7.12 KB
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
"""
Django settings for tkweb project.
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Application definition
DEFAULT_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.flatpages',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.sites',
'django.contrib.staticfiles',
'django.contrib.humanize',
]
THIRD_PARTY_APPS = [
'django_nyt',
'mptt',
'sekizai',
'bootstrap3',
'constance',
'constance.backends.database',
'jfu',
'sorl.thumbnail',
'versatileimagefield',
'django_cleanup',
'macros',
'wiki',
'wiki.plugins.attachments',
'wiki.plugins.globalhistory',
'wiki.plugins.notifications',
'wiki.plugins.images',
'wiki.plugins.macros',
'wiki.plugins.redlinks',
]
LOCAL_APPS = [
'tkweb.apps.barplan',
'tkweb.apps.calendar',
'tkweb.apps.drinks',
'tkweb.apps.eval',
'tkweb.apps.gallery',
'tkweb.apps.idm',
'tkweb.apps.jubi',
'tkweb.apps.krydsliste',
'tkweb.apps.mailinglist',
'tkweb.apps.redirect',
'tkweb.apps.regnskab',
'tkweb.apps.tkbrand',
'tkweb.apps.uniprint',
]
INSTALLED_APPS = LOCAL_APPS + DEFAULT_APPS + THIRD_PARTY_APPS
# Internationalization
# --------------------
# https://docs.djangoproject.com/en/1.8/topics/i18n/
TIME_ZONE = 'Europe/Copenhagen'
LANGUAGE_CODE = 'da'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# URLs
# ----
ROOT_URLCONF = 'tkweb.urls'
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://example.com/media/", "http://media.example.com/"
MEDIA_URL = '/media/'
# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = '/static/'
LOGIN_URL = '/admin/login/'
LOGOUT_URL = '/admin/logout/'
# Media files
# -----------
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/var/www/example.com/media/"
MEDIA_ROOT = os.path.join(BASE_DIR, '../media/')
# Static files
# ------------
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/var/www/example.com/static/"
STATIC_ROOT = os.path.join(BASE_DIR, '../static/')
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Don't forget to use absolute paths, not relative paths.
"static-src",
)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
# Bootstrap3
# ----------
BOOTSTRAP3 = {
# The base_url is the default from django-bootstrap3. It is included here
# so the version can follow the version of the git-submodule of bootstrap
# located at static-src/bootstrap.
# The javascript is loaded based on the base_url. Currently from a CDN.
'base_url': '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/',
# The css is from static-src/bootstrap via static-src/style.less.
# This way it is possible to customize the css\less, without all the
# dependencies need to compile the whole bootstrap.
#
# This file can be updated with
# `lessc --clean-css style.less style.min.css` on a machine with `node.js`,
# `less` and `less-plugin-clean-css`.
'css_url': STATIC_URL + 'style.min.css',
}
# Templates
# ---------
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, '../templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'constance.context_processors.config',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.request',
'django.template.context_processors.static',
'django.template.context_processors.debug',
'sekizai.context_processors.sekizai',
],
'debug': False,
},
},
]
# Thumbnails
# ----------
VERSATILEIMAGEFIELD_RENDITION_KEY_SETS = {
'gallery': [
('gallery_253', 'crop__253x253'),
('image_400', 'thumbnail__400x400'),
('image_720', 'thumbnail__720x720'),
('image_940', 'thumbnail__940x940'),
('image_1140', 'thumbnail__1140x1140'),
('image_2280', 'thumbnail__2280x2280'),
],
}
# Middleware
# ----------
MIDDLEWARE = [
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
]
# Clickjacking middleware
# -----------------------
X_FRAME_OPTIONS = 'DENY'
# Test
# ----
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
# Sites
# -----
SITE_ID = 1
# Constance
# ---------
CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend'
CONSTANCE_CONFIG = {
'GFYEAR': (2015,
'Året hvor nuværende BEST blev valgt'),
'ICAL_URL': ('https://www.google.com/calendar/ical/best@taagekammeret.dk/public/basic.ics',
'iCalendar URLen hvor den offentlige kalender bliver genereret fra.'),
'CAL_URL': ('//calendar.google.com/calendar/embed?src=BEST@TAAGEKAMMERET.dk&ctz=Europe/Copenhagen',
'URLen til \'Tilføj til din egen kalender\'-linket på kalendersiden.'),
'PRIDE': (False, 'Skriv TÅGEKAMMERET i regnbuens farver på hjemmesiden'),
'UKRAINE': (False, 'Skriv TÅGEKAMMERET i blåt og gult på hjemmesiden'),
'GINKA_STANDIN_2022': (False, 'GINKA er stand-in for INKA 22/23'),
}
# Wiki
# ----
WIKI_MARKDOWN_HTML_ATTRIBUTES = {
'a': ['href', 'title', 'class', 'id', 'role', 'data-toggle',
'aria-expanded', 'aria-controls',],
'p': ['class', 'id', 'style',],
'span': ['class', 'id', 'style',],
}
WIKI_MARKDOWN_HTML_STYLES = ['vertical-align', 'font-weight', 'margin-left',
'display', 'transform', 'margin-top']
WIKI_URL_CASE_SENSITIVE = True
WIKI_ANONYMOUS = False
WIKI_ACCOUNT_HANDLING = False
WIKI_MARKDOWN_KWARGS = {
'extensions': [
'markdown.extensions.footnotes',
'markdown.extensions.attr_list',
'markdown.extensions.def_list',
'markdown.extensions.tables',
'markdown.extensions.abbr',
'markdown.extensions.sane_lists',
'markdown.extensions.admonition',
],
'extension_configs': {
'wiki.plugins.macros.mdx.toc': {'title': 'Indhold'},
'wiki.core.markdown.mdx.codehilite': {'guess_lang': False},
},
}
# Uniprint
# --------
PRINT_USERNAME_PREFIX = "tk-"
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'