We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Implement Content Security Policy
which means we can't have inline javascript!

* https://docs.djangoproject.com/en/3.1/topics/security/
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `ephios/event_management/templatetags/event_extras.py`
Content:
```
1 from django import template
2 from django.utils.safestring import mark_safe
3 
4 from ephios.event_management.models import AbstractParticipation
5 
6 register = template.Library()
7 
8 
9 @register.filter(name="shift_status")
10 def shift_status(shift, user):
11     participation = user.as_participant().participation_for(shift)
12     if participation is not None:
13         color = {
14             AbstractParticipation.States.USER_DECLINED: "text-danger",
15             AbstractParticipation.States.RESPONSIBLE_REJECTED: "text-danger",
16             AbstractParticipation.States.REQUESTED: "text-warning",
17             AbstractParticipation.States.CONFIRMED: "text-success",
18         }[participation.state]
19         return mark_safe(f'<span class="{color}">{participation.get_state_display()}</span><br>')
20     return ""
21 
22 
23 @register.filter(name="can_sign_up")
24 def can_sign_up(shift, user):
25     return shift.signup_method.can_sign_up(user.as_participant())
26 
27 
28 @register.filter(name="render_shift_state")
29 def render_shift_state(shift, request):
30     return shift.signup_method.render_shift_state(request)
31 
32 
33 @register.filter(name="signup_errors")
34 def signup_errors(shift, user):
35     return shift.signup_method.get_signup_errors(user.as_participant())
36 
37 
38 @register.filter(name="can_user_decline")
39 def can_user_decline(shift, user):
40     return shift.signup_method.can_decline(user.as_participant())
41 
42 
43 @register.filter(name="decline_errors")
44 def decline_errors(shift, user):
45     return shift.signup_method.get_decline_errors(user.as_participant())
46
```

Path: `ephios/settings.py`
Content:
```
1 """
2 Django settings for ephios project.
3 
4 Generated by 'django-admin startproject' using Django 3.0.6.
5 
6 For more information on this file, see
7 https://docs.djangoproject.com/en/3.0/topics/settings/
8 
9 For the full list of settings and their values, see
10 https://docs.djangoproject.com/en/3.0/ref/settings/
11 """
12 
13 import os
14 
15 from email.utils import getaddresses
16 
17 import environ
18 
19 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
20 
21 env = environ.Env()
22 # for syntax see https://django-environ.readthedocs.io/en/latest/
23 environ.Env.read_env(env_file=os.path.join(BASE_DIR, ".env"))
24 
25 SECRET_KEY = env.str("SECRET_KEY")
26 DEBUG = env.bool("DEBUG")
27 ALLOWED_HOSTS = env.list("ALLOWED_HOSTS")
28 SITE_URL = env.str("SITE_URL")
29 
30 if not DEBUG:
31     SESSION_COOKIE_SECURE = True
32     CSRF_COOKIE_SECURE = True
33     X_FRAME_OPTIONS = "DENY"
34     SECURE_CONTENT_TYPE_NOSNIFF = True
35     SECURE_BROWSER_XSS_FILTER = True
36     SECURE_SSL_REDIRECT = True
37     SECURE_HSTS_SECONDS = 3600
38     SECURE_HSTS_INCLUDE_SUBDOMAINS = True
39     SECURE_REFERRER_POLICY = "same-origin"
40 
41 # Application definition
42 
43 INSTALLED_APPS = [
44     "django.contrib.admin",
45     "django.contrib.auth",
46     "polymorphic",
47     "django.contrib.contenttypes",
48     "django.contrib.sessions",
49     "django.contrib.messages",
50     "django.contrib.staticfiles",
51     "bootstrap4",
52     "guardian",
53     "django_select2",
54     "jquery",
55     "djangoformsetjs",
56     "ephios.user_management",
57     "ephios.event_management",
58     "ephios.helpers",
59     "ephios.plugins.basesignup",
60     "ephios.plugins.pages",
61 ]
62 
63 MIDDLEWARE = [
64     "django.middleware.security.SecurityMiddleware",
65     "django.contrib.sessions.middleware.SessionMiddleware",
66     "django.middleware.common.CommonMiddleware",
67     "django.middleware.csrf.CsrfViewMiddleware",
68     "django.contrib.auth.middleware.AuthenticationMiddleware",
69     "django.contrib.messages.middleware.MessageMiddleware",
70     "django.middleware.clickjacking.XFrameOptionsMiddleware",
71 ]
72 
73 ROOT_URLCONF = "ephios.urls"
74 
75 TEMPLATES = [
76     {
77         "BACKEND": "django.template.backends.django.DjangoTemplates",
78         "DIRS": [os.path.join(BASE_DIR, "ephios/templates")],
79         "APP_DIRS": True,
80         "OPTIONS": {
81             "context_processors": [
82                 "django.template.context_processors.debug",
83                 "django.template.context_processors.request",
84                 "django.contrib.auth.context_processors.auth",
85                 "django.contrib.messages.context_processors.messages",
86                 "ephios.helpers.context.ephios_base_context",
87             ],
88         },
89     },
90 ]
91 
92 LOCALE_PATHS = (os.path.join(BASE_DIR, "ephios/locale"),)
93 
94 WSGI_APPLICATION = "ephios.wsgi.application"
95 
96 # Database
97 # https://docs.djangoproject.com/en/3.0/ref/settings/#databases
98 
99 DATABASES = {"default": env.db_url()}
100 
101 # Password validation
102 # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
103 
104 AUTH_PASSWORD_VALIDATORS = [
105     {
106         "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
107     },
108     {
109         "NAME": "user_management.utils.CustomMinimumLengthValidator",
110     },
111     {
112         "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
113     },
114     {
115         "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
116     },
117 ]
118 
119 AUTHENTICATION_BACKENDS = (
120     "django.contrib.auth.backends.ModelBackend",
121     "guardian.backends.ObjectPermissionBackend",
122 )
123 
124 AUTH_USER_MODEL = "user_management.UserProfile"
125 LOGIN_REDIRECT_URL = "/"
126 
127 # Internationalization
128 # https://docs.djangoproject.com/en/3.0/topics/i18n/
129 
130 LANGUAGE_CODE = "de-de"
131 
132 TIME_ZONE = "Europe/Berlin"
133 
134 USE_I18N = True
135 
136 USE_L10N = True
137 
138 USE_TZ = True
139 
140 # Static files (CSS, JavaScript, Images)
141 # https://docs.djangoproject.com/en/3.0/howto/static-files/
142 
143 STATIC_URL = env.str("STATIC_URL")
144 STATIC_ROOT = env.str("STATIC_ROOT")
145 STATICFILES_DIRS = (os.path.join(BASE_DIR, "ephios/static"),)
146 
147 # mail configuration
148 EMAIL_CONFIG = env.email_url("EMAIL_URL")
149 vars().update(EMAIL_CONFIG)
150 DEFAULT_FROM_EMAIL = env.str("DEFAULT_FROM_EMAIL")
151 SERVER_EMAIL = env.str("SERVER_EMAIL")
152 ADMINS = getaddresses([env("ADMINS")])
153 
154 # Guardian configuration
155 ANONYMOUS_USER_NAME = None
156 GUARDIAN_MONKEY_PATCH = False
157 
158 # django-select2
159 # Prevent django-select from loading the select2 resources as we want to serve them locally
160 SELECT2_JS = ""
161 SELECT2_CSS = ""
162 SELECT2_I18N_PATH = ""
163 
164 # django-debug-toolbar
165 if DEBUG:
166     INSTALLED_APPS.append("django_extensions")
167     INSTALLED_APPS.append("debug_toolbar")
168     MIDDLEWARE.insert(0, "debug_toolbar.middleware.DebugToolbarMiddleware")
169     INTERNAL_IPS = env.str("INTERNAL_IPS")
170
```

Path: `ephios/helpers/context.py`
Content:
```
1 from ephios.helpers.signals import footer_link
2 
3 
4 def ephios_base_context(request):
5     footer = {}
6     for receiver, result in footer_link.send(None, request=request):
7         for label, url in result.items():
8             footer[label] = url
9 
10     return {
11         "footer": footer,
12     }
13
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/ephios/event_management/templatetags/event_extras.py b/ephios/event_management/templatetags/event_extras.py
--- a/ephios/event_management/templatetags/event_extras.py
+++ b/ephios/event_management/templatetags/event_extras.py
@@ -35,8 +35,8 @@
     return shift.signup_method.get_signup_errors(user.as_participant())
 
 
-@register.filter(name="can_user_decline")
-def can_user_decline(shift, user):
+@register.filter(name="can_decline")
+def can_decline(shift, user):
     return shift.signup_method.can_decline(user.as_participant())
 
 
diff --git a/ephios/helpers/context.py b/ephios/helpers/context.py
--- a/ephios/helpers/context.py
+++ b/ephios/helpers/context.py
@@ -1,3 +1,6 @@
+from django.templatetags.static import static
+from django.utils.translation import get_language
+
 from ephios.helpers.signals import footer_link
 
 
@@ -7,6 +10,8 @@
         for label, url in result.items():
             footer[label] = url
 
-    return {
-        "footer": footer,
-    }
+    datatables_translation_url = None
+    if get_language() == "de-de":
+        datatables_translation_url = static("datatables/german.json")
+
+    return {"footer": footer, "datatables_translation_url": datatables_translation_url}
diff --git a/ephios/settings.py b/ephios/settings.py
--- a/ephios/settings.py
+++ b/ephios/settings.py
@@ -68,6 +68,7 @@
     "django.contrib.auth.middleware.AuthenticationMiddleware",
     "django.contrib.messages.middleware.MessageMiddleware",
     "django.middleware.clickjacking.XFrameOptionsMiddleware",
+    "csp.middleware.CSPMiddleware",
 ]
 
 ROOT_URLCONF = "ephios.urls"

{"golden_diff": "diff --git a/ephios/event_management/templatetags/event_extras.py b/ephios/event_management/templatetags/event_extras.py\n--- a/ephios/event_management/templatetags/event_extras.py\n+++ b/ephios/event_management/templatetags/event_extras.py\n@@ -35,8 +35,8 @@\n     return shift.signup_method.get_signup_errors(user.as_participant())\n \n \n-@register.filter(name=\"can_user_decline\")\n-def can_user_decline(shift, user):\n+@register.filter(name=\"can_decline\")\n+def can_decline(shift, user):\n     return shift.signup_method.can_decline(user.as_participant())\n \n \ndiff --git a/ephios/helpers/context.py b/ephios/helpers/context.py\n--- a/ephios/helpers/context.py\n+++ b/ephios/helpers/context.py\n@@ -1,3 +1,6 @@\n+from django.templatetags.static import static\n+from django.utils.translation import get_language\n+\n from ephios.helpers.signals import footer_link\n \n \n@@ -7,6 +10,8 @@\n         for label, url in result.items():\n             footer[label] = url\n \n-    return {\n-        \"footer\": footer,\n-    }\n+    datatables_translation_url = None\n+    if get_language() == \"de-de\":\n+        datatables_translation_url = static(\"datatables/german.json\")\n+\n+    return {\"footer\": footer, \"datatables_translation_url\": datatables_translation_url}\ndiff --git a/ephios/settings.py b/ephios/settings.py\n--- a/ephios/settings.py\n+++ b/ephios/settings.py\n@@ -68,6 +68,7 @@\n     \"django.contrib.auth.middleware.AuthenticationMiddleware\",\n     \"django.contrib.messages.middleware.MessageMiddleware\",\n     \"django.middleware.clickjacking.XFrameOptionsMiddleware\",\n+    \"csp.middleware.CSPMiddleware\",\n ]\n \n ROOT_URLCONF = \"ephios.urls\"\n", "issue": "Implement Content Security Policy\nwhich means we can't have inline javascript!\r\n\r\n* https://docs.djangoproject.com/en/3.1/topics/security/\r\n* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src\n", "before_files": [{"content": "from django import template\nfrom django.utils.safestring import mark_safe\n\nfrom ephios.event_management.models import AbstractParticipation\n\nregister = template.Library()\n\n\n@register.filter(name=\"shift_status\")\ndef shift_status(shift, user):\n    participation = user.as_participant().participation_for(shift)\n    if participation is not None:\n        color = {\n            AbstractParticipation.States.USER_DECLINED: \"text-danger\",\n            AbstractParticipation.States.RESPONSIBLE_REJECTED: \"text-danger\",\n            AbstractParticipation.States.REQUESTED: \"text-warning\",\n            AbstractParticipation.States.CONFIRMED: \"text-success\",\n        }[participation.state]\n        return mark_safe(f'<span class=\"{color}\">{participation.get_state_display()}</span><br>')\n    return \"\"\n\n\n@register.filter(name=\"can_sign_up\")\ndef can_sign_up(shift, user):\n    return shift.signup_method.can_sign_up(user.as_participant())\n\n\n@register.filter(name=\"render_shift_state\")\ndef render_shift_state(shift, request):\n    return shift.signup_method.render_shift_state(request)\n\n\n@register.filter(name=\"signup_errors\")\ndef signup_errors(shift, user):\n    return shift.signup_method.get_signup_errors(user.as_participant())\n\n\n@register.filter(name=\"can_user_decline\")\ndef can_user_decline(shift, user):\n    return shift.signup_method.can_decline(user.as_participant())\n\n\n@register.filter(name=\"decline_errors\")\ndef decline_errors(shift, user):\n    return shift.signup_method.get_decline_errors(user.as_participant())\n", "path": "ephios/event_management/templatetags/event_extras.py"}, {"content": "\"\"\"\nDjango settings for ephios project.\n\nGenerated by 'django-admin startproject' using Django 3.0.6.\n\nFor more information on this file, see\nhttps://docs.djangoproject.com/en/3.0/topics/settings/\n\nFor the full list of settings and their values, see\nhttps://docs.djangoproject.com/en/3.0/ref/settings/\n\"\"\"\n\nimport os\n\nfrom email.utils import getaddresses\n\nimport environ\n\nBASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\n\nenv = environ.Env()\n# for syntax see https://django-environ.readthedocs.io/en/latest/\nenviron.Env.read_env(env_file=os.path.join(BASE_DIR, \".env\"))\n\nSECRET_KEY = env.str(\"SECRET_KEY\")\nDEBUG = env.bool(\"DEBUG\")\nALLOWED_HOSTS = env.list(\"ALLOWED_HOSTS\")\nSITE_URL = env.str(\"SITE_URL\")\n\nif not DEBUG:\n    SESSION_COOKIE_SECURE = True\n    CSRF_COOKIE_SECURE = True\n    X_FRAME_OPTIONS = \"DENY\"\n    SECURE_CONTENT_TYPE_NOSNIFF = True\n    SECURE_BROWSER_XSS_FILTER = True\n    SECURE_SSL_REDIRECT = True\n    SECURE_HSTS_SECONDS = 3600\n    SECURE_HSTS_INCLUDE_SUBDOMAINS = True\n    SECURE_REFERRER_POLICY = \"same-origin\"\n\n# Application definition\n\nINSTALLED_APPS = [\n    \"django.contrib.admin\",\n    \"django.contrib.auth\",\n    \"polymorphic\",\n    \"django.contrib.contenttypes\",\n    \"django.contrib.sessions\",\n    \"django.contrib.messages\",\n    \"django.contrib.staticfiles\",\n    \"bootstrap4\",\n    \"guardian\",\n    \"django_select2\",\n    \"jquery\",\n    \"djangoformsetjs\",\n    \"ephios.user_management\",\n    \"ephios.event_management\",\n    \"ephios.helpers\",\n    \"ephios.plugins.basesignup\",\n    \"ephios.plugins.pages\",\n]\n\nMIDDLEWARE = [\n    \"django.middleware.security.SecurityMiddleware\",\n    \"django.contrib.sessions.middleware.SessionMiddleware\",\n    \"django.middleware.common.CommonMiddleware\",\n    \"django.middleware.csrf.CsrfViewMiddleware\",\n    \"django.contrib.auth.middleware.AuthenticationMiddleware\",\n    \"django.contrib.messages.middleware.MessageMiddleware\",\n    \"django.middleware.clickjacking.XFrameOptionsMiddleware\",\n]\n\nROOT_URLCONF = \"ephios.urls\"\n\nTEMPLATES = [\n    {\n        \"BACKEND\": \"django.template.backends.django.DjangoTemplates\",\n        \"DIRS\": [os.path.join(BASE_DIR, \"ephios/templates\")],\n        \"APP_DIRS\": True,\n        \"OPTIONS\": {\n            \"context_processors\": [\n                \"django.template.context_processors.debug\",\n                \"django.template.context_processors.request\",\n                \"django.contrib.auth.context_processors.auth\",\n                \"django.contrib.messages.context_processors.messages\",\n                \"ephios.helpers.context.ephios_base_context\",\n            ],\n        },\n    },\n]\n\nLOCALE_PATHS = (os.path.join(BASE_DIR, \"ephios/locale\"),)\n\nWSGI_APPLICATION = \"ephios.wsgi.application\"\n\n# Database\n# https://docs.djangoproject.com/en/3.0/ref/settings/#databases\n\nDATABASES = {\"default\": env.db_url()}\n\n# Password validation\n# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators\n\nAUTH_PASSWORD_VALIDATORS = [\n    {\n        \"NAME\": \"django.contrib.auth.password_validation.UserAttributeSimilarityValidator\",\n    },\n    {\n        \"NAME\": \"user_management.utils.CustomMinimumLengthValidator\",\n    },\n    {\n        \"NAME\": \"django.contrib.auth.password_validation.CommonPasswordValidator\",\n    },\n    {\n        \"NAME\": \"django.contrib.auth.password_validation.NumericPasswordValidator\",\n    },\n]\n\nAUTHENTICATION_BACKENDS = (\n    \"django.contrib.auth.backends.ModelBackend\",\n    \"guardian.backends.ObjectPermissionBackend\",\n)\n\nAUTH_USER_MODEL = \"user_management.UserProfile\"\nLOGIN_REDIRECT_URL = \"/\"\n\n# Internationalization\n# https://docs.djangoproject.com/en/3.0/topics/i18n/\n\nLANGUAGE_CODE = \"de-de\"\n\nTIME_ZONE = \"Europe/Berlin\"\n\nUSE_I18N = True\n\nUSE_L10N = True\n\nUSE_TZ = True\n\n# Static files (CSS, JavaScript, Images)\n# https://docs.djangoproject.com/en/3.0/howto/static-files/\n\nSTATIC_URL = env.str(\"STATIC_URL\")\nSTATIC_ROOT = env.str(\"STATIC_ROOT\")\nSTATICFILES_DIRS = (os.path.join(BASE_DIR, \"ephios/static\"),)\n\n# mail configuration\nEMAIL_CONFIG = env.email_url(\"EMAIL_URL\")\nvars().update(EMAIL_CONFIG)\nDEFAULT_FROM_EMAIL = env.str(\"DEFAULT_FROM_EMAIL\")\nSERVER_EMAIL = env.str(\"SERVER_EMAIL\")\nADMINS = getaddresses([env(\"ADMINS\")])\n\n# Guardian configuration\nANONYMOUS_USER_NAME = None\nGUARDIAN_MONKEY_PATCH = False\n\n# django-select2\n# Prevent django-select from loading the select2 resources as we want to serve them locally\nSELECT2_JS = \"\"\nSELECT2_CSS = \"\"\nSELECT2_I18N_PATH = \"\"\n\n# django-debug-toolbar\nif DEBUG:\n    INSTALLED_APPS.append(\"django_extensions\")\n    INSTALLED_APPS.append(\"debug_toolbar\")\n    MIDDLEWARE.insert(0, \"debug_toolbar.middleware.DebugToolbarMiddleware\")\n    INTERNAL_IPS = env.str(\"INTERNAL_IPS\")\n", "path": "ephios/settings.py"}, {"content": "from ephios.helpers.signals import footer_link\n\n\ndef ephios_base_context(request):\n    footer = {}\n    for receiver, result in footer_link.send(None, request=request):\n        for label, url in result.items():\n            footer[label] = url\n\n    return {\n        \"footer\": footer,\n    }\n", "path": "ephios/helpers/context.py"}], "after_files": [{"content": "from django import template\nfrom django.utils.safestring import mark_safe\n\nfrom ephios.event_management.models import AbstractParticipation\n\nregister = template.Library()\n\n\n@register.filter(name=\"shift_status\")\ndef shift_status(shift, user):\n    participation = user.as_participant().participation_for(shift)\n    if participation is not None:\n        color = {\n            AbstractParticipation.States.USER_DECLINED: \"text-danger\",\n            AbstractParticipation.States.RESPONSIBLE_REJECTED: \"text-danger\",\n            AbstractParticipation.States.REQUESTED: \"text-warning\",\n            AbstractParticipation.States.CONFIRMED: \"text-success\",\n        }[participation.state]\n        return mark_safe(f'<span class=\"{color}\">{participation.get_state_display()}</span><br>')\n    return \"\"\n\n\n@register.filter(name=\"can_sign_up\")\ndef can_sign_up(shift, user):\n    return shift.signup_method.can_sign_up(user.as_participant())\n\n\n@register.filter(name=\"render_shift_state\")\ndef render_shift_state(shift, request):\n    return shift.signup_method.render_shift_state(request)\n\n\n@register.filter(name=\"signup_errors\")\ndef signup_errors(shift, user):\n    return shift.signup_method.get_signup_errors(user.as_participant())\n\n\n@register.filter(name=\"can_decline\")\ndef can_decline(shift, user):\n    return shift.signup_method.can_decline(user.as_participant())\n\n\n@register.filter(name=\"decline_errors\")\ndef decline_errors(shift, user):\n    return shift.signup_method.get_decline_errors(user.as_participant())\n", "path": "ephios/event_management/templatetags/event_extras.py"}, {"content": "\"\"\"\nDjango settings for ephios project.\n\nGenerated by 'django-admin startproject' using Django 3.0.6.\n\nFor more information on this file, see\nhttps://docs.djangoproject.com/en/3.0/topics/settings/\n\nFor the full list of settings and their values, see\nhttps://docs.djangoproject.com/en/3.0/ref/settings/\n\"\"\"\n\nimport os\n\nfrom email.utils import getaddresses\n\nimport environ\n\nBASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\n\nenv = environ.Env()\n# for syntax see https://django-environ.readthedocs.io/en/latest/\nenviron.Env.read_env(env_file=os.path.join(BASE_DIR, \".env\"))\n\nSECRET_KEY = env.str(\"SECRET_KEY\")\nDEBUG = env.bool(\"DEBUG\")\nALLOWED_HOSTS = env.list(\"ALLOWED_HOSTS\")\nSITE_URL = env.str(\"SITE_URL\")\n\nif not DEBUG:\n    SESSION_COOKIE_SECURE = True\n    CSRF_COOKIE_SECURE = True\n    X_FRAME_OPTIONS = \"DENY\"\n    SECURE_CONTENT_TYPE_NOSNIFF = True\n    SECURE_BROWSER_XSS_FILTER = True\n    SECURE_SSL_REDIRECT = True\n    SECURE_HSTS_SECONDS = 3600\n    SECURE_HSTS_INCLUDE_SUBDOMAINS = True\n    SECURE_REFERRER_POLICY = \"same-origin\"\n\n# Application definition\n\nINSTALLED_APPS = [\n    \"django.contrib.admin\",\n    \"django.contrib.auth\",\n    \"polymorphic\",\n    \"django.contrib.contenttypes\",\n    \"django.contrib.sessions\",\n    \"django.contrib.messages\",\n    \"django.contrib.staticfiles\",\n    \"bootstrap4\",\n    \"guardian\",\n    \"django_select2\",\n    \"jquery\",\n    \"djangoformsetjs\",\n    \"ephios.user_management\",\n    \"ephios.event_management\",\n    \"ephios.helpers\",\n    \"ephios.plugins.basesignup\",\n    \"ephios.plugins.pages\",\n]\n\nMIDDLEWARE = [\n    \"django.middleware.security.SecurityMiddleware\",\n    \"django.contrib.sessions.middleware.SessionMiddleware\",\n    \"django.middleware.common.CommonMiddleware\",\n    \"django.middleware.csrf.CsrfViewMiddleware\",\n    \"django.contrib.auth.middleware.AuthenticationMiddleware\",\n    \"django.contrib.messages.middleware.MessageMiddleware\",\n    \"django.middleware.clickjacking.XFrameOptionsMiddleware\",\n    \"csp.middleware.CSPMiddleware\",\n]\n\nROOT_URLCONF = \"ephios.urls\"\n\nTEMPLATES = [\n    {\n        \"BACKEND\": \"django.template.backends.django.DjangoTemplates\",\n        \"DIRS\": [os.path.join(BASE_DIR, \"ephios/templates\")],\n        \"APP_DIRS\": True,\n        \"OPTIONS\": {\n            \"context_processors\": [\n                \"django.template.context_processors.debug\",\n                \"django.template.context_processors.request\",\n                \"django.contrib.auth.context_processors.auth\",\n                \"django.contrib.messages.context_processors.messages\",\n                \"ephios.helpers.context.ephios_base_context\",\n            ],\n        },\n    },\n]\n\nLOCALE_PATHS = (os.path.join(BASE_DIR, \"ephios/locale\"),)\n\nWSGI_APPLICATION = \"ephios.wsgi.application\"\n\n# Database\n# https://docs.djangoproject.com/en/3.0/ref/settings/#databases\n\nDATABASES = {\"default\": env.db_url()}\n\n# Password validation\n# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators\n\nAUTH_PASSWORD_VALIDATORS = [\n    {\n        \"NAME\": \"django.contrib.auth.password_validation.UserAttributeSimilarityValidator\",\n    },\n    {\n        \"NAME\": \"user_management.utils.CustomMinimumLengthValidator\",\n    },\n    {\n        \"NAME\": \"django.contrib.auth.password_validation.CommonPasswordValidator\",\n    },\n    {\n        \"NAME\": \"django.contrib.auth.password_validation.NumericPasswordValidator\",\n    },\n]\n\nAUTHENTICATION_BACKENDS = (\n    \"django.contrib.auth.backends.ModelBackend\",\n    \"guardian.backends.ObjectPermissionBackend\",\n)\n\nAUTH_USER_MODEL = \"user_management.UserProfile\"\nLOGIN_REDIRECT_URL = \"/\"\n\n# Internationalization\n# https://docs.djangoproject.com/en/3.0/topics/i18n/\n\nLANGUAGE_CODE = \"de-de\"\n\nTIME_ZONE = \"Europe/Berlin\"\n\nUSE_I18N = True\n\nUSE_L10N = True\n\nUSE_TZ = True\n\n# Static files (CSS, JavaScript, Images)\n# https://docs.djangoproject.com/en/3.0/howto/static-files/\n\nSTATIC_URL = env.str(\"STATIC_URL\")\nSTATIC_ROOT = env.str(\"STATIC_ROOT\")\nSTATICFILES_DIRS = (os.path.join(BASE_DIR, \"ephios/static\"),)\n\n# mail configuration\nEMAIL_CONFIG = env.email_url(\"EMAIL_URL\")\nvars().update(EMAIL_CONFIG)\nDEFAULT_FROM_EMAIL = env.str(\"DEFAULT_FROM_EMAIL\")\nSERVER_EMAIL = env.str(\"SERVER_EMAIL\")\nADMINS = getaddresses([env(\"ADMINS\")])\n\n# Guardian configuration\nANONYMOUS_USER_NAME = None\nGUARDIAN_MONKEY_PATCH = False\n\n# django-select2\n# Prevent django-select from loading the select2 resources as we want to serve them locally\nSELECT2_JS = \"\"\nSELECT2_CSS = \"\"\nSELECT2_I18N_PATH = \"\"\n\n# django-debug-toolbar\nif DEBUG:\n    INSTALLED_APPS.append(\"django_extensions\")\n    INSTALLED_APPS.append(\"debug_toolbar\")\n    MIDDLEWARE.insert(0, \"debug_toolbar.middleware.DebugToolbarMiddleware\")\n    INTERNAL_IPS = env.str(\"INTERNAL_IPS\")\n", "path": "ephios/settings.py"}, {"content": "from django.templatetags.static import static\nfrom django.utils.translation import get_language\n\nfrom ephios.helpers.signals import footer_link\n\n\ndef ephios_base_context(request):\n    footer = {}\n    for receiver, result in footer_link.send(None, request=request):\n        for label, url in result.items():\n            footer[label] = url\n\n    datatables_translation_url = None\n    if get_language() == \"de-de\":\n        datatables_translation_url = static(\"datatables/german.json\")\n\n    return {\"footer\": footer, \"datatables_translation_url\": datatables_translation_url}\n", "path": "ephios/helpers/context.py"}]}