forked from proycon/flat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
602 lines (461 loc) · 25.5 KB
/
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
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
##############################################################################
# FoLiA Linguistic Annotation Tool (FLAT) - Settings file
#
# These are the settings for your FLAT site.
#
#---------------------------------------------------------------------------
# PREAMBLE (don't edit this part)
#---------------------------------------------------------------------------
import sys
from django import VERSION as DJANGOVERSION
from socket import gethostname
import os.path
from os import environ
from glob import glob
import json
import yaml
import flat
VERSION = flat.VERSION
try:
BASE_DIR = os.path.dirname(os.path.dirname(flat.__file__)) + "/"
except:
BASE_DIR = os.path.dirname(os.path.dirname(flat.__path__)) + "/"
hostname = gethostname()
##############################################################################
# DATABASE CONFIGURATION
##############################################################################
# Either edit this section or use environment variables to configure it at run-time.
# The latter is recommended in container setups.
#Configure your database here, by default a simple sqlite database will be used
DATABASES = {
'default': {
'ENGINE': environ.get("FLAT_DATABASE_ENGINE", 'django.db.backends.sqlite3'), # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': environ.get("FLAT_DATABASE", '/data/flat.db'), # Or path to database file if using sqlite3. (change this!)
# The following settings are not used with sqlite3:
'USER': environ.get("FLAT_DATABASE_USER",""),
'PASSWORD': environ.get("FLAT_DATABASE_PASSWORD",""),
'HOST': environ.get("FLAT_DATABASE_HOST",""), # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': environ.get("FLAT_DATABASE_PORT",""), # Set to empty string for default.
}
}
##############################################################################
# FOLIA DOCUMENT SERVER CONFIGURATION
##############################################################################
# Either edit this section or use environment variables to configure it at run-time.
# The latter is recommended in container setups.
#This is the path to the document root directory, this is the same directory as specified when running foliadocserve.
#If the document server is running on a different system, the remote root disk will have to be mounted and the mountpoint specified here.
WORKDIR = environ.get("FLAT_DOCROOT","/data/flat.docroot/")
#The path and port on which the FoLiA Document Server can be reached (these defaults suffice for a local connection)
FOLIADOCSERVE_HOST = environ.get("FOLIADOCSERVE_HOST", '127.0.0.1')
FOLIADOCSERVE_PORT = int(environ.get("FOLIADOCSERVE_PORT", '8080'))
# Make sure to start the document server when starting FLAT!
# $ foliadocserve -d /data/flat.docroot -p 8080
##############################################################################
# FLAT CONFIGURATION
##############################################################################
# Either edit this section or use environment variables to configure it at run-time.
# The latter is recommended in container setups.
# In addition, you can pass a FLAT_CONFIG_DIR variable
# with YAML configuration files (*.yml) for each configuration.
# FLAT consists of several modes, the user can select a mode from the menu.
# Each enables the user to do completely different things.
# The following modes are available and enabled. Simply
# comment the ones you want to disable:
MODES = [
('viewer','Viewer'),
('editor','Annotation Editor'),
('structureeditor','Structure Editor'),
('metadata','Metadata Editor'),
]
#Alternatively pass a FLAT_MODES environment variable with comma-delimited values like: viewer,editor,metadata
if environ.get('FLAT_MODES'): MODES.filter(lambda x: x[0] in environ['FLAT_MODES'].split(","))
# The viewer and editor allow for different perspectives on the data.
# - document: view of the entire document
# - toc: view of a named subsection of the document (a table of contents will
# be automatically constructed)
# - any other FoLiA XML tag corresponsing to a structural element: paged data
# over this type of element
if environ.get('FLAT_PERSPECTIVES'):
PERSPECTIVES = [ x.strip() for x in environ['FLAT_PERSPECTIVES'].split(",") ]
else:
PERSPECTIVES = [ 'document', 'toc', 'p', 's' ]
# Which mode should be used by default when the user opens a document?
DEFAULTMODE = environ.get('FLAT_DEFAULTMODE','editor')
# You may have several configurations for FLAT, a configuration determines what
# features will be enabled and what defaults will be set. Enabling all features
# will often be daunting and confusing for end-users. Using the configurations,
# you can fine-tune what users will see based on what is needed for your
# project(s).
# Users choose a configuration when logging in, the following configuration
# will be selected by default:
DEFAULTCONFIGURATION = environ.get('FLAT_DEFAULTCONFIGURATION', 'full')
# Allow users to register their own accounts? (1=True, 0=False)
ALLOWREGISTRATION = bool(int(environ.get('FLAT_ALLOWREGISTRATION',True)))
# Allow public anonymous uploads without any authentication?
ALLOWPUBLICUPLOAD = bool(int(environ.get('FLAT_ALLOWPUBLICUPLOAD',True)))
#These are the configurations, add new ones by copying the 'full' configuration and adapting it to your needs.
#INSTEAD of specifying them here, you can load configurations from YAML files (*.yml) in a a configuration directory
#you pass using the FLAT_CONFIG_DIR variable. The filename determines the configuration name (e.g. full.yml -> full).
CONFIGURATIONS = {
'full':{
# This is the 'full' configuration, it will enable all available functionality and is not fine-tuned for any specific task
# The name of the mode, this is what users will see in the login screen,
# make sure the name is indicative of your annotation project, if any
'name': "Full Editor",
# use the editor modes defined globally, or specify them explicitly per configuration here.
'modes': MODES,
# use the perspectives defined globally, or specify them explicitly per configuration here.
'perspectives': PERSPECTIVES,
# Allow users to upload FoLiA documents?
'allowupload': True, #boolean
#Automatically create namespaces for all the groups a user is in and has write permission for,
'creategroupnamespaces': True, #boolean
# The default annotation focus upon loading a document
# The annotation type that has is set as annotation focus will be
# visualised. Set to a valid FoLiA tag name (see the FoLiA documentation at
# https://proycon.github.io/folia) or None to start without a specific focus
'annotationfocustype': None,
# If you set the above, you will also need to set what FoLiA set to use
'annotationfocusset': None,
#EXAMPLES:
#'annotationfocustype': 'correction',
#'annotationfocusset': 'http://raw.github.com/proycon/folia/master/setdefinitions/spellingcorrection.foliaset.xml',
#'annotationfocustype': 'entity',
#'annotationfocusset': 'https://raw.githubusercontent.com/proycon/folia/master/setdefinitions/namedentities.foliaset.xml',
# Automatically enable the select span button for the annotation focus when opening the editor dialog
'autoselectspan': False,
# List of FoLiA annotation types (xml tags) that are allowed as annotation focus, set to True to enable all.
# Users may switch annotation focus through the menu
# Here and everywhere else, the annotation type equals the FoLiA XML tag
# for the annotation, specific sets may be attached to annotation types using a slash, for example:
# entity/https://raw.githubusercontent.com/proycon/folia/master/setdefinitions/namedentities.foliaset.xml
'allowedannotationfocus': True,
#EXAMPLE:
#'allowedannotationfocus': ('entity/https://raw.githubusercontent.com/proycon/folia/master/setdefinitions/namedentities.foliaset.xml'),
# List of FoLiA annotation types (xml tags) that are initially enabled in
# the local annotation viewer (the pop-up when the user hovers over elements)
# set to True to enable all
'initialviewannotations': True,
# List of FoLiA annotation types (xml tags) that are initially enabled in
# the global annotation viewer (in the annotation box above the words)
'initialglobviewannotations': [],
# List of FoLiA annotation types (xml tags) that are allowed to be viewed,
# a superset of initialviewannotations/initialglobviewannotations. Users can enable/disable each as
# they see fit. Set to True to enable all
'allowedviewannotations': True,
# List of FoLiA annotation types (xml tags) that are initially enabled in the editor dialog (when users click an element for editing)
# set to True to enable all
'initialeditannotations': True,
# List of FoLiA annotation types (xml tags) that are allowed in the editor
# dialog (the user can enable/disable each as he/she sees fit), set to True
# to enable all
'allowededitannotations': True,
# Allow the user to add annotation types not yet present on a certain element?
# If set to False, users can only edit existing annotations, never add new ones
'allowaddfields': True, #boolean
# Allow the user to add annotation types not yet present in the document?
'allowdeclare': True, #boolean
# The following values correspond to edit forms,
# They are shown as a set of option buttons in the editor dialog, between
# which the user can choose. Each of these options enables a button (if
# only one is selected, no buttons appear). The edit forms can be
# enabled/disabled by the user from a menu.
#Enable direct editing (this is the default and most basic form of editing)
#It should be True unless you want to force other editing forms
'editformdirect': True, #boolean
#Enable editing as correction
'editformcorrection': False, #boolean
#Enable editing as alternative
'editformalternative': False, #boolean
#Enable editing as new, this allows for adding multiple or overlapping annotations of the same type
'editformnew': True, #boolean
#Enable editing the structure element (i.e. its class)
'editstructure': True,
#This defines what edit modes the user can enable/disable from the menu himself/herself
'alloweditformdirect': True, #boolean
'alloweditformcorrection': True, #boolean
'alloweditformalternative': True, #boolean
'alloweditformnew': True, #boolean
#Allow confidence values to be set/edited?
'allowconfidence': True,
#Allow enabling/disabling editing the structure element (i.e. its class)
'alloweditstructure': True,
#Always assign colors for tags by frequency?
'colorbyfreq': False,
# FoLiA set to use for corrections
#'initialcorrectionset': 'http://raw.github.com/proycon/folia/master/setdefinitions/spellingcorrection.foliaset.xml',
# List of 2-tuples (tag,set) that specify what annotation types and with
# what sets to declare automatically for each document that is opened.
# (recall that FoLiA demands all annotations to be declared and that sets
# can be custom-made by anyone)
#'autodeclare': [
# ('correction', 'http://raw.github.com/proycon/folia/master/setdefinitions/spellingcorrection.foliaset.xml')
# ('entity', 'https://raw.githubusercontent.com/proycon/folia/master/setdefinitions/namedentities.foliaset.xml')
#],
# List of 2-tuples (tag,set) that specify what annotation types and with
# what are required sets to be already present for each document that is
# opened. This is more or less the opposite of autodeclare
#'requiredeclaration': [
# ('correction', 'http://raw.github.com/proycon/folia/master/setdefinitions/spellingcorrection.foliaset.xml')
# ('entity', 'https://raw.githubusercontent.com/proycon/folia/master/setdefinitions/namedentities.foliaset.xml')
#],
#List of metadata keys (in FoLiA's native metadata) to show in the
# document index.
#'metadataindex': ['status','language','title'],
#Dictionary of metadata keys to lists of possible values, constrains the values in the metadata editor rather than offering a free-fill field. Example:
#'metadataconstraints': {'language': ['fr','en','es'], 'status':['completed','inprogress']},
#'searches': [{'query': 'SELECT entity WHERE annotatortype = "manual" FOR w RETURN target', 'label': "Highlight manually annotated entities", 'changeperspective': false}],
#Slices are strongly tied to perspectives and determines how big of a slice to show per page for each
#perspective. Setting this (and choosing the desired perspective) enables pagination through documents. The value is a
#comma-delimited string of ``tag:number`` pairs, for instance: ``p:25,s:100`` to set a page size of 25 paragraphs in
#the paragraph perspective, and 100 sentences in the sentence perspective. Note that if you make the size of a page too
#large, you will be confronted with the error: *"Loading aborted: there was too much data to display at once"*.
#slices: 'p:25,s:100',
'converters': [
{ 'id': 'conllu2folia',
'module': 'foliatools.conllu2folia',
'function': 'flat_convert',
'name': "CONLL-U",
'parameter_help': 'Metadata. Set <em>"direction": "rtl"</em> for right-to left languages (JSON syntax without the envelopping curly braces)', #human readable help for parameters
'parameter_default': '', #default parameter, JSON syntax without the envelopping {}
'inputextensions': ['conllu','conll'],
},
{ 'id': 'rst2folia',
'module': 'foliatools.rst2folia',
'function': 'flat_convert',
'name': "ReStructuredText",
'parameter_help': '', #human readable help for parameters
'parameter_default': '', #default parameter, JSON syntax without the envelopping {}
'inputextensions': ['rst'],
},
]
},
}
if environ.get("FLAT_CONFIG_DIR"):
# You can also define configurations externally in .yml files (YAML syntax),
# the following code will load them INSTEAD OF the above configuration
CONFIGURATIONS = {}
for configfile in glob(os.path.join(environ['FLAT_CONFIG_DIR'],"*.yml")):
configname = os.path.basename(configfile).split('.')[0]
print(f"Loading {configname} from {configfile}",file=sys.stderr)
with open(configfile,'r', encoding='utf-8') as f:
CONFIGURATIONS[configname] = yaml.safe_load(f.read())
if not CONFIGURATIONS:
raise Exception(f"No configurations found in {environ['FLAT_CONFIG_DIR']}")
##############################################################################
# DJANGO SETTINGS THAT NEED TO BE CHANGED (so edit me!)
#############################################################################
ADMINS = ( #Change to your contact details
(environ.get("FLAT_ADMIN_NAME",'FLAT Administrator'), environ.get("FLAT_EMAIL","")),
)
# Make this unique, and don't share it with anybody.
# IMPORTANT!!!! GENERATE A NEW SECRET KEY !!!! The default one here is *NOT*
# secret as it's publicly disclosed in the FLAT sources!
# (Use for instance http://www.miniwebtool.com/django-secret-key-generator/)
SECRET_KEY = environ.get("FLAT_SECRET_KEY", 'ki5^nfv01@1g7(+*#l_0fmi9h&cf^_lv6bs4j9^6mpr&(%o4zk')
DEBUG = int(environ.get("FLAT_DEBUG",0)) #Keep set to False (0) for production environments!!!!
#Enable the following if you are behind a HTTPS proxy (you should be if you run a public instance!)
#Make sure your reverse proxy sets and forwards the X-Forwarded-Proto header, and strips it from incoming user request
if bool(int(environ.get("FLAT_REVERSE_PROXY_HTTPS",0))):
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
##############################################################################
# DJANGO SETTINGS FOR OPENID CONNECT AUTHENTICATION
#############################################################################
OIDC = bool(int(environ.get("FLAT_OIDC", 0))) #Set this to 1 if you want want OpenID Connect Authentication,
#and uncomment and fill all lines below
#note: The redirect url you register with your authorization provider should end in /oidc/callback/
if OIDC:
AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend','mozilla_django_oidc.auth.OIDCAuthenticationBackend',)
OIDC_RP_CLIENT_ID = environ.get("FLAT_CLIENT_ID","") #As provided by your authorization provider, do not check this into public version control!!!
OIDC_RP_CLIENT_SECRET = environ.get("FLAT_CLIENT_SECRET","") #As provider by your authorization provider, Do not check this into public version control!!!
OIDC_OP_AUTHORIZATION_ENDPOINT = environ.get("FLAT_AUTH_ENDPOINT","") # URL of the OIDC OP authorization endpoint
OIDC_OP_TOKEN_ENDPOINT = environ.get("FLAT_TOKEN_ENDPOINT","") #URL of the OIDC OP token endpoint
OIDC_OP_USER_ENDPOINT = environ.get("FLAT_USER_ENDPOINT","") #URL of the OIDC OP userinfo endpoint
#You may also need the following for OpenID Connect:
OIDC_TOKEN_USE_BASIC_AUTH = bool(int(environ.get("FLAT_TOKEN_USE_BASIC_AUTH", 1))) #Use client_secret_basic, if not enabled, client_secret_post will be default
OIDC_RP_SIGN_ALGO = environ.get("FLAT_SIGN_ALGO", "RS256") #should be HS256 or RS256
OIDC_OP_JWKS_ENDPOINT = environ.get("FLAT_JWKS_ENDPOINT","") #URL of the OIDC OP JWKS endpoint, to obtain the signing key automatically
#or provide the signing key manually:
OIDC_RP_IDP_SIGN_KEY = json.loads(environ.get("FLAT_IDP_SIGN_KEY",""))
#example key: {
# "kty": "RSA",
# "use": "sig",
# "alg": "RS256",
# "n": "", #to be filled!
# "e": "AQAB"
#}
##############################################################################
# DJANGO SETTINGS THAT NEED NOT BE CHANGED (but you may if you want to, do scroll through at least)
#############################################################################
# Feel free to tweak settings here, but the defaults should be enough
MANAGERS = ADMINS
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = [ "localhost", "127.0.0.1", environ.get("FLAT_DOMAIN", "flat.yourdomain.org") ]
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = environ.get("FLAT_TIMEZONE", 'Europe/Amsterdam')
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = False
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/var/www/example.com/media/"
MEDIA_ROOT = BASE_DIR + 'usermedia/' #not used currently by FLAT
# 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 = 'http://flat.science.ru.nl/usermedia/' #not used currently by FLAT
# 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 = BASE_DIR + '/flat/static/'
#If you don't run at the document root of your webserver/virtual host, set BASE_PREFIX to your URL prefix (no trailing slash), e.g BASE_PREFIX = "/flat"
#leave empty in all other scenarios
BASE_PREFIX = environ.get("FLAT_BASE_PREFIX", "")
if BASE_PREFIX: FORCE_SCRIPT_NAME = BASE_PREFIX
# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = BASE_PREFIX + '/static/'
STYLE_ROOT = BASE_DIR + '/flat/style/'
STYLE_URL = BASE_PREFIX + '/style/'
SCRIPT_ROOT = BASE_DIR + '/flat/script/'
SCRIPT_URL = BASE_PREFIX + '/script/'
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
BASE_DIR + '/flat/style/',
BASE_DIR + '/flat/script/',
)
# 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',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
LOGIN_URL = BASE_PREFIX + "/login/" #don't change this
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
MIDDLEWARE = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'flat.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'flat.wsgi.application'
TEMPLATE_DIRS = [
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
BASE_DIR + 'flat/templates/'
]
for mode,_ in MODES:
if os.path.isdir(BASE_DIR + '/flat/modes/' + mode + '/templates/'):
TEMPLATE_DIRS.append(BASE_DIR + '/flat/modes/' + mode + '/templates/')
TEMPLATE_DIRS = tuple(TEMPLATE_DIRS)
TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
'DIRS': TEMPLATE_DIRS,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},]
del TEMPLATE_DIRS
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
#'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'flat.users'
]
if OIDC: INSTALLED_APPS.insert(1, 'mozilla_django_oidc')
for mode,_ in MODES:
INSTALLED_APPS.append('flat.modes.' + mode)
INSTALLED_APPS = tuple(INSTALLED_APPS)
LOGIN_REDIRECT_URL = BASE_PREFIX + "/"
LOGOUT_REDIRECT_URL = BASE_PREFIX + "/"
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
#LOGGING = {
# 'version': 1,
# 'disable_existing_loggers': False,
# 'filters': {
# 'require_debug_false': {
# '()': 'django.utils.log.RequireDebugFalse'
# }
# },
# 'handlers': {
# 'mail_admins': {
# 'level': 'ERROR',
# 'filters': ['require_debug_false'],
# 'class': 'django.utils.log.AdminEmailHandler'
# }
# },
# 'loggers': {
# 'django.request': {
# 'handlers': ['mail_admins'],
# 'level': 'ERROR',
# 'propagate': True,
# },
# }
#}
###########################################################################################################
# PROTECTION AGAINST LAZINESS, GENERAL SLOPPINESS, OVERCONFIDENCE, AND DOCUMENTATION READING IMPAIRMENTS
###########################################################################################################
#Remove this when done configuring:
raise Exception("settings.py hasn't been configured yet!!") #remove me
# Now you can start FLAT as follows (container users can ignore all of the below):
# $ export PYTHONPATH=/your/settings/path/
# $ export DJANGO_SETTINGS_MODULE=settings
# $ django-admin runserver
# But before the first time you run you will want to run the migrations and populate the
# database:
# $ export PYTHONPATH=/your/settings/path/
# $ export DJANGO_SETTINGS_MODULE=settings
# $ django-admin migrate --run-syncdb
# $ django-admin createsuperuser
# In any case, don't forget to start the document server too:
# $ foliadocserve -d /path/to/document/root -p 8080 --git
# If you use the --git option, make sure your git identity is configured
# git config --global user.email "you@example.com"
# git config --global user.name "Your Name"