OpenSlides/openslides/global_settings.py

161 lines
3.5 KiB
Python
Raw Normal View History

import os
from openslides.utils.plugins import collect_plugins
MODULE_DIR = os.path.realpath(os.path.dirname(os.path.abspath(__file__)))
2012-02-09 17:35:18 +01:00
# Application definition
INSTALLED_APPS = [
'openslides.core',
'openslides.users',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.staticfiles',
'rest_framework',
'channels',
'openslides.agenda',
'openslides.topics',
'openslides.motions',
'openslides.assignments',
'openslides.mediafiles',
]
INSTALLED_PLUGINS = collect_plugins() # Adds all automaticly collected plugins
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'openslides.urls'
ALLOWED_HOSTS = ['*']
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.10/topics/i18n/
LANGUAGE_CODE = 'en'
2012-02-09 17:35:18 +01:00
LANGUAGES = (
('en', 'English'),
('de', 'Deutsch'),
('fr', 'Français'),
('es', 'Español'),
('pt', 'Português'),
('cs', 'Český'),
2012-02-09 17:35:18 +01:00
)
TIME_ZONE = 'UTC'
2012-02-09 17:35:18 +01:00
USE_I18N = True
USE_L10N = True
USE_TZ = True
LOCALE_PATHS = [
os.path.join(MODULE_DIR, 'locale'),
]
2012-02-09 17:35:18 +01:00
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/
2012-02-09 17:35:18 +01:00
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(MODULE_DIR, '..', 'collected-static')
STATICFILES_DIRS = [
os.path.join(MODULE_DIR, 'static'),
]
2012-02-09 17:35:18 +01:00
# Sessions and user authentication
# https://docs.djangoproject.com/en/1.10/topics/http/sessions/
# https://docs.djangoproject.com/en/1.10/topics/auth/
2012-02-09 17:35:18 +01:00
AUTH_USER_MODEL = 'users.User'
AUTHENTICATION_BACKENDS = [
'openslides.utils.auth.CustomizedModelBackend',
]
SESSION_COOKIE_NAME = 'OpenSlidesSessionID'
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
CSRF_COOKIE_NAME = 'OpenSlidesCsrfToken'
CSRF_COOKIE_AGE = None
PASSWORD_HASHERS = [
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
'django.contrib.auth.hashers.Argon2PasswordHasher',
'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
'django.contrib.auth.hashers.BCryptPasswordHasher',
'django.contrib.auth.hashers.MD5PasswordHasher', # MD5 is only used for initial passwords.
]
# Files
# https://docs.djangoproject.com/en/1.10/topics/files/
MEDIA_URL = '/media/'
# Cache
# https://docs.djangoproject.com/en/1.10/topics/cache/
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': 'openslides-cache',
'OPTIONS': {
'MAX_ENTRIES': 10000
}
}
}
# Django REST framework
# http://www.django-rest-framework.org/api-guide/settings/
REST_FRAMEWORK = {
2015-05-05 10:42:31 +02:00
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.SessionAuthentication',
'openslides.utils.auth.RESTFrameworkAnonymousAuthentication',
2015-05-05 10:42:31 +02:00
)
}
# Django Channels
# http://channels.readthedocs.io/en/latest/
CHANNEL_LAYERS = {
'default': {
'BACKEND': 'asgiref.inmemory.ChannelLayer',
'ROUTING': 'openslides.routing.channel_routing',
'CONFIG': {
'capacity': 1000,
},
},
}