2015-01-05 15:01:42 +01:00
|
|
|
"""
|
2016-09-08 11:13:21 +02:00
|
|
|
Settings file for OpenSlides.
|
2015-01-05 15:01:42 +01:00
|
|
|
|
|
|
|
For more information on this file, see
|
2019-09-02 11:09:03 +02:00
|
|
|
https://github.com/OpenSlides/OpenSlides/blob/master/SETTINGS.rst
|
2015-01-05 15:01:42 +01:00
|
|
|
"""
|
2013-10-28 16:34:53 +01:00
|
|
|
|
2014-01-11 15:47:15 +01:00
|
|
|
import os
|
2013-10-28 16:34:53 +01:00
|
|
|
from openslides.global_settings import *
|
2014-01-11 15:47:15 +01:00
|
|
|
%(import_function)s
|
2015-01-05 15:01:42 +01:00
|
|
|
|
2018-01-16 16:02:23 +01:00
|
|
|
# The directory for user specific data files
|
2015-01-05 15:01:42 +01:00
|
|
|
|
2018-01-16 16:02:23 +01:00
|
|
|
OPENSLIDES_USER_DATA_DIR = %(openslides_user_data_dir)s
|
2013-10-28 16:34:53 +01:00
|
|
|
|
|
|
|
|
2015-01-05 15:01:42 +01:00
|
|
|
# OpenSlides plugins
|
2016-09-08 11:13:21 +02:00
|
|
|
|
2015-01-05 15:01:42 +01:00
|
|
|
# Add plugins to this list (see example entry in comment).
|
|
|
|
|
2013-12-12 21:22:42 +01:00
|
|
|
INSTALLED_PLUGINS += (
|
2016-05-17 14:15:22 +02:00
|
|
|
# 'plugin_module_name',
|
2013-10-28 16:34:53 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
INSTALLED_APPS += INSTALLED_PLUGINS
|
|
|
|
|
2015-01-05 15:01:42 +01:00
|
|
|
|
2016-09-08 11:13:21 +02:00
|
|
|
# Important settings for production use
|
|
|
|
# https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
|
|
|
|
|
|
|
|
# SECURITY WARNING: Keep the secret key used in production secret!
|
|
|
|
|
|
|
|
SECRET_KEY = %(secret_key)r
|
|
|
|
|
|
|
|
# Use 'DEBUG = True' to get more details for server errors.
|
|
|
|
# SECURITY WARNING: Don't run with debug turned on in production!
|
|
|
|
|
|
|
|
DEBUG = %(debug)s
|
|
|
|
|
2019-09-02 11:09:03 +02:00
|
|
|
# Controls the verbosity on errors during a reset password. If enabled, an error
|
|
|
|
# will be shown, if there does not exist a user with a given email address. So one
|
|
|
|
# can check, if a email is registered. If this is not wanted, disable verbose
|
|
|
|
# messages. An success message will always be shown.
|
|
|
|
|
|
|
|
RESET_PASSWORD_VERBOSE_ERRORS = True
|
|
|
|
|
2017-11-28 10:47:29 +01:00
|
|
|
# Email settings
|
|
|
|
# For SSL/TLS specific settings see https://docs.djangoproject.com/en/1.11/topics/email/#smtp-backend
|
|
|
|
|
|
|
|
EMAIL_HOST = 'localhost'
|
|
|
|
EMAIL_PORT = 587
|
|
|
|
EMAIL_HOST_USER = ''
|
|
|
|
EMAIL_HOST_PASSWORD = ''
|
2019-06-25 15:49:15 +02:00
|
|
|
DEFAULT_FROM_EMAIL = 'noreply@example.com'
|
2016-09-08 11:13:21 +02:00
|
|
|
|
2019-02-25 09:28:32 +01:00
|
|
|
# Increasing Upload size to 100mb (default is 2.5mb)
|
|
|
|
DATA_UPLOAD_MAX_MEMORY_SIZE = 104857600
|
|
|
|
|
2015-01-05 15:01:42 +01:00
|
|
|
# Database
|
2016-09-08 11:13:21 +02:00
|
|
|
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
|
|
|
|
|
|
|
|
# Change this setting to use e. g. PostgreSQL or MySQL.
|
2015-01-05 15:01:42 +01:00
|
|
|
|
2016-09-30 21:43:22 +02:00
|
|
|
# DATABASES = {
|
|
|
|
# 'default': {
|
|
|
|
# 'ENGINE': 'django.db.backends.postgresql',
|
|
|
|
# 'NAME': 'mydatabase',
|
|
|
|
# 'USER': 'mydatabaseuser',
|
|
|
|
# 'PASSWORD': 'mypassword',
|
|
|
|
# 'HOST': '127.0.0.1',
|
|
|
|
# 'PORT': '5432',
|
|
|
|
# }
|
|
|
|
# }
|
|
|
|
|
2015-01-05 15:01:42 +01:00
|
|
|
DATABASES = {
|
|
|
|
'default': {
|
|
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
2018-01-16 16:02:23 +01:00
|
|
|
'NAME': os.path.join(OPENSLIDES_USER_DATA_DIR, 'db.sqlite3'),
|
2015-01-05 15:01:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-12-17 09:30:20 +01:00
|
|
|
# Set use_redis to True to activate redis as cache-, asgi- and session backend.
|
|
|
|
use_redis = False
|
2016-09-08 11:13:21 +02:00
|
|
|
|
2016-12-17 09:30:20 +01:00
|
|
|
if use_redis:
|
|
|
|
# Django Channels
|
2016-09-08 11:13:21 +02:00
|
|
|
|
2018-07-09 23:22:26 +02:00
|
|
|
# https://channels.readthedocs.io/en/latest/topics/channel_layers.html#configuration
|
2018-11-21 15:41:27 +01:00
|
|
|
CHANNEL_LAYERS = {
|
|
|
|
"default": {
|
|
|
|
"BACKEND": "channels_redis.core.RedisChannelLayer",
|
|
|
|
"CONFIG": {
|
|
|
|
"hosts": [("localhost", 6379)],
|
|
|
|
"capacity": 100000,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2018-07-09 23:22:26 +02:00
|
|
|
# Collection Cache
|
2016-12-17 09:30:20 +01:00
|
|
|
|
2018-07-09 23:22:26 +02:00
|
|
|
# Can be:
|
|
|
|
# a Redis URI — "redis://host:6379/0?encoding=utf-8";
|
|
|
|
# a (host, port) tuple — ('localhost', 6379);
|
|
|
|
# or a unix domain socket path string — "/path/to/redis.sock".
|
|
|
|
REDIS_ADDRESS = "redis://127.0.0.1"
|
2016-12-17 09:30:20 +01:00
|
|
|
|
|
|
|
# Session backend
|
|
|
|
|
2018-07-09 23:22:26 +02:00
|
|
|
# Redis configuration for django-redis-sessions.
|
2016-12-17 09:30:20 +01:00
|
|
|
# https://github.com/martinrusev/django-redis-sessions
|
|
|
|
|
|
|
|
SESSION_ENGINE = 'redis_sessions.session'
|
2018-07-09 23:22:26 +02:00
|
|
|
SESSION_REDIS = {
|
|
|
|
'host': '127.0.0.1',
|
2019-04-08 09:52:04 +02:00
|
|
|
'port': 6379,
|
2018-07-09 23:22:26 +02:00
|
|
|
'db': 0,
|
2019-04-02 14:24:39 +02:00
|
|
|
'prefix': 'session',
|
|
|
|
'socket_timeout': 2
|
2018-07-09 23:22:26 +02:00
|
|
|
}
|
2016-09-08 11:13:21 +02:00
|
|
|
|
2019-08-20 12:00:54 +02:00
|
|
|
# SAML integration
|
|
|
|
# Please read https://github.com/OpenSlides/OpenSlides/blob/master/openslides/saml/README.md
|
|
|
|
# for additional requirements.
|
|
|
|
|
|
|
|
ENABLE_SAML = False
|
|
|
|
if ENABLE_SAML:
|
|
|
|
INSTALLED_APPS += ['openslides.saml']
|
|
|
|
|
2016-05-29 08:29:14 +02:00
|
|
|
|
2019-11-05 09:30:55 +01:00
|
|
|
# Controls if electronic voting (means non-analog polls) are enabled.
|
|
|
|
ENABLE_ELECTRONIC_VOTING = False
|
|
|
|
|
|
|
|
|
2016-09-08 11:13:21 +02:00
|
|
|
# Internationalization
|
|
|
|
# https://docs.djangoproject.com/en/1.10/topics/i18n/
|
2015-01-05 15:01:42 +01:00
|
|
|
|
2014-01-11 15:47:15 +01:00
|
|
|
TIME_ZONE = 'Europe/Berlin'
|
|
|
|
|
|
|
|
|
2016-09-08 11:13:21 +02:00
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
|
|
# https://docs.djangoproject.com/en/1.10/howto/static-files/
|
2015-01-05 15:01:42 +01:00
|
|
|
|
2018-01-16 16:02:23 +01:00
|
|
|
STATICFILES_DIRS = [os.path.join(OPENSLIDES_USER_DATA_DIR, 'static')] + STATICFILES_DIRS
|
2013-10-28 16:34:53 +01:00
|
|
|
|
2018-01-16 16:02:23 +01:00
|
|
|
STATIC_ROOT = os.path.join(OPENSLIDES_USER_DATA_DIR, 'collected-static')
|
2017-02-15 13:22:08 +01:00
|
|
|
|
2016-09-08 11:13:21 +02:00
|
|
|
|
|
|
|
# Files
|
|
|
|
# https://docs.djangoproject.com/en/1.10/topics/files/
|
|
|
|
|
2018-01-16 16:02:23 +01:00
|
|
|
MEDIA_ROOT = os.path.join(OPENSLIDES_USER_DATA_DIR, 'media', '')
|
2016-09-08 11:13:21 +02:00
|
|
|
|
|
|
|
|
2017-04-13 16:19:20 +02:00
|
|
|
# Password validation
|
|
|
|
# https://docs.djangoproject.com/en/1.10/topics/auth/passwords/#module-django.contrib.auth.password_validation
|
|
|
|
# AUTH_PASSWORD_VALIDATORS = []
|
|
|
|
|
2017-09-18 09:40:57 +02:00
|
|
|
|
2019-05-06 13:00:40 +02:00
|
|
|
# Logging
|
|
|
|
# see https://docs.djangoproject.com/en/2.2/topics/logging/
|
|
|
|
|
|
|
|
LOGGING = {
|
|
|
|
'version': 1,
|
|
|
|
'disable_existing_loggers': False,
|
|
|
|
'formatters': {
|
|
|
|
'gunicorn': {
|
|
|
|
'format': '{asctime} [{process:d}] [{levelname}] {name} {message}',
|
|
|
|
'style': '{',
|
|
|
|
'datefmt': '[%%Y-%%m-%%d %%H:%%M:%%S %%z]',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'handlers': {
|
|
|
|
'console': {
|
|
|
|
'class': 'logging.StreamHandler',
|
|
|
|
'formatter': 'gunicorn',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'loggers': {
|
|
|
|
'django': {
|
|
|
|
'handlers': ['console'],
|
|
|
|
'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
|
|
|
|
},
|
|
|
|
'openslides': {
|
|
|
|
'handlers': ['console'],
|
|
|
|
'level': os.getenv('OPENSLIDES_LOG_LEVEL', 'INFO'),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
2019-08-20 12:00:54 +02:00
|
|
|
|
|
|
|
SETTINGS_FILEPATH = __file__
|