Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • stustanet/wahlfang
  • 011892/wahlfang
  • 014449/wahlfang
  • 015384/wahlfang
4 results
Show changes
"""
Django settings for wahlfang project.
Generated by 'django-admin startproject' using Django 3.0.5.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import logging
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
from django.urls import reverse_lazy
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
ADMINS = (
('Wahlfang Admins', 'root@localhost')
)
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '$rl7hy0b_$*7py@t0-!^%gdlqdv0f%1+h2s%rza@=2h#1$y1vw'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = False
# export application statistics such as http request duration / latency
# will also export # of manager accounts, # of sessions, # of elections
EXPORT_PROMETHEUS_METRICS = True
if DEBUG:
# will output to your console
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s %(levelname)s %(message)s',
)
ALLOWED_HOSTS = ['*']
# Application definition
......@@ -74,7 +50,6 @@ if EXPORT_PROMETHEUS_METRICS:
MIDDLEWARE + \
['django_prometheus.middleware.PrometheusAfterMiddleware']
ROOT_URLCONF = 'wahlfang.urls'
TEMPLATES = [
......@@ -96,7 +71,6 @@ TEMPLATES = [
AUTHENTICATION_BACKENDS = {
'vote.authentication.AccessCodeBackend',
'management.authentication.ManagementBackend',
'management.authentication.ManagementBackendLDAP',
'django.contrib.auth.backends.ModelBackend'
}
......@@ -108,16 +82,6 @@ CHANNEL_LAYERS = {
}
}
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
......@@ -165,11 +129,6 @@ USE_TZ = True
# https://docs.djangoproject.com/en/3.0/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = '/var/www/wahlfang/static'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
CRISPY_TEMPLATE_PACK = 'bootstrap4'
......@@ -178,24 +137,53 @@ CRISPY_TEMPLATE_PACK = 'bootstrap4'
CSP_DEFAULT_SRC = ("'self'",)
CSP_IMG_SRC = ("'self'", "data:",)
# Mail
EMAIL_HOST = 'mail.stusta.de'
EMAIL_SENDER = 'no-reply@stusta.de'
EMAIL_PORT = 25
VALID_MANAGER_EMAIL_DOMAINS = [
'stusta.de', 'stustanet.de', 'stusta.mhn.de', 'stusta.net', 'stusta.sexy', 'stusta.party', 'stusta.io'
]
# Base URL for template links (without 'https://')
URL = 'vote.stustanet.de'
# File upload, etc...
MEDIA_ROOT = '/var/www/wahlfang/media'
MEDIA_URL = '/media/'
# LDAP
AUTH_LDAP_SERVER_URI = "ldap://ldap.stusta.de"
AUTH_LDAP_USER_DN_TEMPLATE = "cn=%(user)s,ou=account,ou=pnyx,dc=stusta,dc=mhn,dc=de"
AUTH_LDAP_START_TLS = True
AUTH_LDAP_USER_ATTR_MAP = {'email': 'mail'}
AUTH_LDAP_BIND_AS_AUTHENTICATING_USER = True
#: Default 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'
},
'file': {
'level': 'INFO',
'class': 'logging.handlers.WatchedFileHandler',
'filename': os.path.join(BASE_DIR, 'wahlfang.log'),
'formatter': 'verbose',
},
'console': {
'class': 'logging.StreamHandler',
'formatter': 'simple',
},
},
'loggers': {
'django.request': {
'handlers': ['mail_admins', 'file'],
'level': 'ERROR',
'propagate': True,
},
'django': {
'handlers': ['file'],
'level': 'ERROR',
'propagate': True,
},
},
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(process)d %(name)s %(message)s'
},
'simple': {
'format': '%(levelname)s %(message)s'
},
},
}
import os
import logging
from wahlfang.settings.base import *
from wahlfang.settings.wahlfang import *
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '$rl7hy0b_$*7py@t0-!^%gdlqdv0f%1+h2s%rza@=2h#1$y1vw'
DEBUG = True
# will output to your console
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s %(levelname)s %(message)s',
)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
# Mail
EMAIL_HOST = 'mail.stusta.de'
EMAIL_SENDER = 'no-reply@stusta.de'
EMAIL_PORT = 25
# LDAP
AUTH_LDAP_SERVER_URI = "ldap://ldap.stusta.de"
AUTH_LDAP_USER_DN_TEMPLATE = "cn=%(user)s,ou=account,ou=pnyx,dc=stusta,dc=mhn,dc=de"
AUTH_LDAP_START_TLS = True
AUTH_LDAP_USER_ATTR_MAP = {'email': 'mail'}
AUTH_LDAP_BIND_AS_AUTHENTICATING_USER = True
SEND_FROM_MANAGER_EMAIL = True
VALID_MANAGER_EMAIL_DOMAINS = [
'stusta.de', 'stustanet.de', 'stusta.mhn.de', 'stusta.net', 'stusta.sexy', 'stusta.party', 'stusta.io'
]
# Base URL for template links (without 'https://')
URL = 'vote.stustanet.de'
......@@ -7,10 +7,9 @@ For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'wahlfang.settings')
from wahlfang.manage import setup
setup()
application = get_wsgi_application()