We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Write suceessful/failed logins to syslog
https://docs.python.org/3/library/logging.handlers.html#sysloghandler

This should probably be priority NOTICE and facility LOG_AUTH.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/cms/apps.py`
Content:
```
1 import logging
2 import sys
3 from django.conf import settings
4 from django.apps import AppConfig
5 
6 logger = logging.getLogger(__name__)
7 
8 class CmsConfig(AppConfig):
9     """
10     This class represents the Django-configuration of the backend.
11 
12     See :class:`django.apps.AppConfig` for more information.
13 
14     :param name: The name of the app
15     :type name: str
16     """
17 
18     name = 'cms'
19 
20     def ready(self):
21         """
22         This function gets executed exactly once each time the cms starts. We use it to check wether the secret key was
23         not changed in production mode and show an error message if this is the case.
24 
25         See :meth:`django.apps.AppConfig.ready` for more information.
26         """
27         if settings.SECRET_KEY == '-!v282$zj815_q@htaxcubylo)(l%a+k*-xi78hw*#s2@i86@_' and not settings.DEBUG:
28             logger.error("You are running the Integreat CMS in production mode. Change the SECRET_KEY in the settings.py!")
29             sys.exit(1)
30
```

Path: `src/backend/settings.py`
Content:
```
1 """
2 Django settings for backend project.
3 
4 For more information on this file, see :doc:`topics/settings`.
5 For the full list of settings and their values, see :doc:`ref/settings`.
6 """
7 import os
8 
9 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
10 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
11 
12 
13 # Version number
14 VERSION = '0.0.14'
15 
16 # Quick-start development settings - unsuitable for production
17 # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
18 
19 # SECURITY WARNING: keep the secret key used in production secret!
20 SECRET_KEY = '-!v282$zj815_q@htaxcubylo)(l%a+k*-xi78hw*#s2@i86@_'
21 
22 # SECURITY WARNING: don't run with debug turned on in production!
23 DEBUG = True
24 
25 ALLOWED_HOSTS = [
26     'localhost',
27     '127.0.0.1',
28     '0.0.0.0'
29 ]
30 
31 # Needed for webauthn (this is a setting in case the application runs behind a proxy)
32 HOSTNAME = 'localhost'
33 BASE_URL = 'http://localhost:8000'
34 
35 # Application definition
36 
37 INSTALLED_APPS = [
38     'cms.apps.CmsConfig',
39     'gvz_api.apps.GvzApiConfig',
40     'django.contrib.admin',
41     'django.contrib.auth',
42     'django.contrib.contenttypes',
43     'django.contrib.messages',
44     'django.contrib.sessions',
45     'django.contrib.staticfiles',
46     'compressor',
47     'compressor_toolkit',
48     'corsheaders',
49     'widget_tweaks',
50     'easy_thumbnails',
51     'filer',
52     'mptt',
53     'rules.apps.AutodiscoverRulesConfig',
54 ]
55 
56 MIDDLEWARE = [
57     'corsheaders.middleware.CorsMiddleware',
58     'django.middleware.security.SecurityMiddleware',
59     'django.contrib.sessions.middleware.SessionMiddleware',
60     'django.middleware.locale.LocaleMiddleware',
61     'django.middleware.common.CommonMiddleware',
62     'django.middleware.csrf.CsrfViewMiddleware',
63     'django.contrib.auth.middleware.AuthenticationMiddleware',
64     'django.contrib.messages.middleware.MessageMiddleware',
65     'django.middleware.clickjacking.XFrameOptionsMiddleware',
66 ]
67 
68 ROOT_URLCONF = 'backend.urls'
69 THUMBNAIL_HIGH_RESOLUTION = True
70 
71 TEMPLATES = [
72     {
73         'BACKEND': 'django.template.backends.django.DjangoTemplates',
74         'DIRS': [],
75         'APP_DIRS': True,
76         'OPTIONS': {
77             'context_processors': [
78                 'django.template.context_processors.debug',
79                 'django.template.context_processors.request',
80                 'django.contrib.auth.context_processors.auth',
81                 'django.contrib.messages.context_processors.messages',
82                 'backend.context_processors.region_slug_processor',
83             ],
84             'debug': DEBUG,
85         },
86     },
87 ]
88 
89 WSGI_APPLICATION = 'backend.wsgi.application'
90 
91 
92 # Database
93 # https://docs.djangoproject.com/en/2.2/ref/settings/#databases
94 
95 DATABASES = {
96     'default': {
97         'ENGINE': 'django.db.backends.postgresql_psycopg2',
98         'NAME': 'integreat',
99         'USER': 'integreat',
100         'PASSWORD': 'password',
101         'HOST': 'localhost',
102         'PORT': '5432',
103     }
104 }
105 
106 # Directory for initial database contents
107 
108 FIXTURE_DIRS = (
109     os.path.join(BASE_DIR, 'cms/fixtures/'),
110 )
111 
112 # Authentication backends
113 
114 AUTHENTICATION_BACKENDS = (
115     'rules.permissions.ObjectPermissionBackend',
116     'django.contrib.auth.backends.ModelBackend',  # this is default
117 )
118 
119 
120 # Password validation
121 # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
122 
123 AUTH_PASSWORD_VALIDATORS = [
124     {
125         'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
126     },
127     {
128         'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
129     },
130     {
131         'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
132     },
133     {
134         'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
135     },
136 ]
137 
138 
139 # Internationalization
140 # https://docs.djangoproject.com/en/2.2/topics/i18n/
141 
142 LANGUAGES = (
143     ('en-us', 'English'),
144     ('de-de', 'Deutsch'),
145 )
146 
147 LOCALE_PATHS = (
148     os.path.join(BASE_DIR, 'locale'),
149 )
150 
151 LANGUAGE_CODE = 'de-de'
152 
153 TIME_ZONE = 'UTC'
154 
155 USE_I18N = True
156 
157 USE_L10N = True
158 
159 USE_TZ = True
160 
161 
162 # Static files (CSS, JavaScript, Images)
163 # https://docs.djangoproject.com/en/2.2/howto/static-files/
164 
165 STATICFILES_DIRS = [
166     os.path.join(BASE_DIR, "../node_modules"),
167 ]
168 STATIC_URL = '/static/'
169 STATIC_ROOT = os.path.join(BASE_DIR, 'cms/static/')
170 
171 # Login
172 LOGIN_URL = '/login'
173 LOGIN_REDIRECT_URL = '/'
174 LOGOUT_REDIRECT_URL = '/login'
175 
176 # Miscellaneous
177 EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
178 CSRF_FAILURE_VIEW = 'cms.views.error_handler.csrf_failure'
179 
180 MEDIA_URL = '/media/'
181 MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
182 FILER_CANONICAL_URL = 'media/'
183 
184 LOGGING = {
185     'version': 1,
186     'disable_existing_loggers': False,
187     'handlers': {
188         'console': {
189             'class': 'logging.StreamHandler'
190         },
191     },
192     'loggers': {
193         'django': {
194             'handlers': ['console'],
195             'level': 'WARN',
196             'propagate': True,
197         },
198         'api': {
199             'handlers': ['console'],
200             'level': 'INFO',
201             'propagate': True,
202         },
203         'cms': {
204             'handlers': ['console'],
205             'level': 'INFO',
206             'propagate': True,
207         },
208         'rules': {
209             'handlers': ['console'],
210             'level': 'DEBUG',
211             'propagate': True,
212         },
213     }
214 }
215 
216 STATICFILES_FINDERS = (
217     'django.contrib.staticfiles.finders.FileSystemFinder',
218     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
219     'compressor.finders.CompressorFinder',
220 )
221 
222 COMPRESS_CSS_FILTERS = [
223     'compressor.filters.css_default.CssAbsoluteFilter',
224     'compressor.filters.cssmin.CSSMinFilter',
225     'compressor.filters.template.TemplateFilter'
226 ]
227 COMPRESS_JS_FILTERS = [
228     'compressor.filters.jsmin.JSMinFilter',
229 ]
230 COMPRESS_PRECOMPILERS = (
231     ('module', 'compressor_toolkit.precompilers.ES6Compiler'),
232     ('css', 'compressor_toolkit.precompilers.SCSSCompiler'),
233 )
234 COMPRESS_ENABLED = False
235 COMPRESS_OFFLINE = True
236 
237 # GVZ (Gemeindeverzeichnis) API URL
238 GVZ_API_URL = "http://gvz.integreat-app.de/api/"
239 GVZ_API_ENABLED = True
240 
241 # Allow access to all domains by setting the following variable to TRUE
242 CORS_ORIGIN_ALLOW_ALL = True
243 
244 # Extend default headers with development header to differenciate dev traffic in statistics
245 CORS_ALLOW_HEADERS = [
246     'accept',
247     'accept-encoding',
248     'authorization',
249     'content-type',
250     'dnt',
251     'origin',
252     'user-agent',
253     'x-csrftoken',
254     'x-requested-with',
255     'x-integreat-development',
256 ]
257
```
--- 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/src/backend/settings.py b/src/backend/settings.py
--- a/src/backend/settings.py
+++ b/src/backend/settings.py
@@ -184,9 +184,33 @@
 LOGGING = {
     'version': 1,
     'disable_existing_loggers': False,
+    'formatters': {
+        'default': {
+            'format': 'INTEGREAT CMS - %(levelname)s: %(message)s',
+        },
+        'console': {
+            'format': '%(asctime)s INTEGREAT CMS - %(levelname)s: %(message)s',
+            'datefmt': '%b %d %H:%M:%S',
+        }
+    },
     'handlers': {
         'console': {
-            'class': 'logging.StreamHandler'
+            'class': 'logging.StreamHandler',
+            'formatter': 'console'
+        },
+        'authlog': {
+            'level': 'INFO',
+            'class': 'logging.handlers.SysLogHandler',
+            'address': '/dev/log',
+            'facility': 'auth',
+            'formatter': 'default',
+        },
+        'syslog': {
+            'level': 'INFO',
+            'class': 'logging.handlers.SysLogHandler',
+            'address': '/dev/log',
+            'facility': 'syslog',
+            'formatter': 'default',
         },
     },
     'loggers': {
@@ -210,6 +234,10 @@
             'level': 'DEBUG',
             'propagate': True,
         },
+        'auth': {
+            'handlers': ['console', 'authlog', 'syslog'],
+            'level': 'INFO',
+        },
     }
 }
 
diff --git a/src/cms/apps.py b/src/cms/apps.py
--- a/src/cms/apps.py
+++ b/src/cms/apps.py
@@ -1,7 +1,10 @@
 import logging
 import sys
+
 from django.conf import settings
 from django.apps import AppConfig
+from django.contrib.auth.signals import user_logged_in, user_logged_out, user_login_failed
+from django.dispatch import receiver
 
 logger = logging.getLogger(__name__)
 
@@ -27,3 +30,21 @@
         if settings.SECRET_KEY == '-!v282$zj815_q@htaxcubylo)(l%a+k*-xi78hw*#s2@i86@_' and not settings.DEBUG:
             logger.error("You are running the Integreat CMS in production mode. Change the SECRET_KEY in the settings.py!")
             sys.exit(1)
+
+
+authlog = logging.getLogger("auth")
+
+@receiver(user_logged_in)
+def user_logged_in_callback(sender, request, user, **kwargs):  # pylint: disable=unused-argument
+    ip = request.META.get('REMOTE_ADDR')
+    authlog.info('login user=%s, ip=%s', user, ip)
+
+@receiver(user_logged_out)
+def user_logged_out_callback(sender, request, user, **kwargs):  # pylint: disable=unused-argument
+    ip = request.META.get('REMOTE_ADDR')
+    authlog.info('logout user=%s, ip=%s', user, ip)
+
+@receiver(user_login_failed)
+def user_login_failed_callback(sender, credentials, request, **kwargs):  # pylint: disable=unused-argument
+    ip = request.META.get('REMOTE_ADDR')
+    authlog.warning('login failed user=%s, ip=%s', credentials['username'], ip)

{"golden_diff": "diff --git a/src/backend/settings.py b/src/backend/settings.py\n--- a/src/backend/settings.py\n+++ b/src/backend/settings.py\n@@ -184,9 +184,33 @@\n LOGGING = {\n     'version': 1,\n     'disable_existing_loggers': False,\n+    'formatters': {\n+        'default': {\n+            'format': 'INTEGREAT CMS - %(levelname)s: %(message)s',\n+        },\n+        'console': {\n+            'format': '%(asctime)s INTEGREAT CMS - %(levelname)s: %(message)s',\n+            'datefmt': '%b %d %H:%M:%S',\n+        }\n+    },\n     'handlers': {\n         'console': {\n-            'class': 'logging.StreamHandler'\n+            'class': 'logging.StreamHandler',\n+            'formatter': 'console'\n+        },\n+        'authlog': {\n+            'level': 'INFO',\n+            'class': 'logging.handlers.SysLogHandler',\n+            'address': '/dev/log',\n+            'facility': 'auth',\n+            'formatter': 'default',\n+        },\n+        'syslog': {\n+            'level': 'INFO',\n+            'class': 'logging.handlers.SysLogHandler',\n+            'address': '/dev/log',\n+            'facility': 'syslog',\n+            'formatter': 'default',\n         },\n     },\n     'loggers': {\n@@ -210,6 +234,10 @@\n             'level': 'DEBUG',\n             'propagate': True,\n         },\n+        'auth': {\n+            'handlers': ['console', 'authlog', 'syslog'],\n+            'level': 'INFO',\n+        },\n     }\n }\n \ndiff --git a/src/cms/apps.py b/src/cms/apps.py\n--- a/src/cms/apps.py\n+++ b/src/cms/apps.py\n@@ -1,7 +1,10 @@\n import logging\n import sys\n+\n from django.conf import settings\n from django.apps import AppConfig\n+from django.contrib.auth.signals import user_logged_in, user_logged_out, user_login_failed\n+from django.dispatch import receiver\n \n logger = logging.getLogger(__name__)\n \n@@ -27,3 +30,21 @@\n         if settings.SECRET_KEY == '-!v282$zj815_q@htaxcubylo)(l%a+k*-xi78hw*#s2@i86@_' and not settings.DEBUG:\n             logger.error(\"You are running the Integreat CMS in production mode. Change the SECRET_KEY in the settings.py!\")\n             sys.exit(1)\n+\n+\n+authlog = logging.getLogger(\"auth\")\n+\n+@receiver(user_logged_in)\n+def user_logged_in_callback(sender, request, user, **kwargs):  # pylint: disable=unused-argument\n+    ip = request.META.get('REMOTE_ADDR')\n+    authlog.info('login user=%s, ip=%s', user, ip)\n+\n+@receiver(user_logged_out)\n+def user_logged_out_callback(sender, request, user, **kwargs):  # pylint: disable=unused-argument\n+    ip = request.META.get('REMOTE_ADDR')\n+    authlog.info('logout user=%s, ip=%s', user, ip)\n+\n+@receiver(user_login_failed)\n+def user_login_failed_callback(sender, credentials, request, **kwargs):  # pylint: disable=unused-argument\n+    ip = request.META.get('REMOTE_ADDR')\n+    authlog.warning('login failed user=%s, ip=%s', credentials['username'], ip)\n", "issue": "Write suceessful/failed logins to syslog\nhttps://docs.python.org/3/library/logging.handlers.html#sysloghandler\r\n\r\nThis should probably be priority NOTICE and facility LOG_AUTH.\n", "before_files": [{"content": "import logging\nimport sys\nfrom django.conf import settings\nfrom django.apps import AppConfig\n\nlogger = logging.getLogger(__name__)\n\nclass CmsConfig(AppConfig):\n    \"\"\"\n    This class represents the Django-configuration of the backend.\n\n    See :class:`django.apps.AppConfig` for more information.\n\n    :param name: The name of the app\n    :type name: str\n    \"\"\"\n\n    name = 'cms'\n\n    def ready(self):\n        \"\"\"\n        This function gets executed exactly once each time the cms starts. We use it to check wether the secret key was\n        not changed in production mode and show an error message if this is the case.\n\n        See :meth:`django.apps.AppConfig.ready` for more information.\n        \"\"\"\n        if settings.SECRET_KEY == '-!v282$zj815_q@htaxcubylo)(l%a+k*-xi78hw*#s2@i86@_' and not settings.DEBUG:\n            logger.error(\"You are running the Integreat CMS in production mode. Change the SECRET_KEY in the settings.py!\")\n            sys.exit(1)\n", "path": "src/cms/apps.py"}, {"content": "\"\"\"\nDjango settings for backend project.\n\nFor more information on this file, see :doc:`topics/settings`.\nFor the full list of settings and their values, see :doc:`ref/settings`.\n\"\"\"\nimport os\n\n# Build paths inside the project like this: os.path.join(BASE_DIR, ...)\nBASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\n\n\n# Version number\nVERSION = '0.0.14'\n\n# Quick-start development settings - unsuitable for production\n# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/\n\n# SECURITY WARNING: keep the secret key used in production secret!\nSECRET_KEY = '-!v282$zj815_q@htaxcubylo)(l%a+k*-xi78hw*#s2@i86@_'\n\n# SECURITY WARNING: don't run with debug turned on in production!\nDEBUG = True\n\nALLOWED_HOSTS = [\n    'localhost',\n    '127.0.0.1',\n    '0.0.0.0'\n]\n\n# Needed for webauthn (this is a setting in case the application runs behind a proxy)\nHOSTNAME = 'localhost'\nBASE_URL = 'http://localhost:8000'\n\n# Application definition\n\nINSTALLED_APPS = [\n    'cms.apps.CmsConfig',\n    'gvz_api.apps.GvzApiConfig',\n    'django.contrib.admin',\n    'django.contrib.auth',\n    'django.contrib.contenttypes',\n    'django.contrib.messages',\n    'django.contrib.sessions',\n    'django.contrib.staticfiles',\n    'compressor',\n    'compressor_toolkit',\n    'corsheaders',\n    'widget_tweaks',\n    'easy_thumbnails',\n    'filer',\n    'mptt',\n    'rules.apps.AutodiscoverRulesConfig',\n]\n\nMIDDLEWARE = [\n    'corsheaders.middleware.CorsMiddleware',\n    'django.middleware.security.SecurityMiddleware',\n    'django.contrib.sessions.middleware.SessionMiddleware',\n    'django.middleware.locale.LocaleMiddleware',\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 = 'backend.urls'\nTHUMBNAIL_HIGH_RESOLUTION = True\n\nTEMPLATES = [\n    {\n        'BACKEND': 'django.template.backends.django.DjangoTemplates',\n        'DIRS': [],\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                'backend.context_processors.region_slug_processor',\n            ],\n            'debug': DEBUG,\n        },\n    },\n]\n\nWSGI_APPLICATION = 'backend.wsgi.application'\n\n\n# Database\n# https://docs.djangoproject.com/en/2.2/ref/settings/#databases\n\nDATABASES = {\n    'default': {\n        'ENGINE': 'django.db.backends.postgresql_psycopg2',\n        'NAME': 'integreat',\n        'USER': 'integreat',\n        'PASSWORD': 'password',\n        'HOST': 'localhost',\n        'PORT': '5432',\n    }\n}\n\n# Directory for initial database contents\n\nFIXTURE_DIRS = (\n    os.path.join(BASE_DIR, 'cms/fixtures/'),\n)\n\n# Authentication backends\n\nAUTHENTICATION_BACKENDS = (\n    'rules.permissions.ObjectPermissionBackend',\n    'django.contrib.auth.backends.ModelBackend',  # this is default\n)\n\n\n# Password validation\n# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators\n\nAUTH_PASSWORD_VALIDATORS = [\n    {\n        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',\n    },\n    {\n        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',\n    },\n    {\n        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',\n    },\n    {\n        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',\n    },\n]\n\n\n# Internationalization\n# https://docs.djangoproject.com/en/2.2/topics/i18n/\n\nLANGUAGES = (\n    ('en-us', 'English'),\n    ('de-de', 'Deutsch'),\n)\n\nLOCALE_PATHS = (\n    os.path.join(BASE_DIR, 'locale'),\n)\n\nLANGUAGE_CODE = 'de-de'\n\nTIME_ZONE = 'UTC'\n\nUSE_I18N = True\n\nUSE_L10N = True\n\nUSE_TZ = True\n\n\n# Static files (CSS, JavaScript, Images)\n# https://docs.djangoproject.com/en/2.2/howto/static-files/\n\nSTATICFILES_DIRS = [\n    os.path.join(BASE_DIR, \"../node_modules\"),\n]\nSTATIC_URL = '/static/'\nSTATIC_ROOT = os.path.join(BASE_DIR, 'cms/static/')\n\n# Login\nLOGIN_URL = '/login'\nLOGIN_REDIRECT_URL = '/'\nLOGOUT_REDIRECT_URL = '/login'\n\n# Miscellaneous\nEMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'\nCSRF_FAILURE_VIEW = 'cms.views.error_handler.csrf_failure'\n\nMEDIA_URL = '/media/'\nMEDIA_ROOT = os.path.join(BASE_DIR, 'media')\nFILER_CANONICAL_URL = 'media/'\n\nLOGGING = {\n    'version': 1,\n    'disable_existing_loggers': False,\n    'handlers': {\n        'console': {\n            'class': 'logging.StreamHandler'\n        },\n    },\n    'loggers': {\n        'django': {\n            'handlers': ['console'],\n            'level': 'WARN',\n            'propagate': True,\n        },\n        'api': {\n            'handlers': ['console'],\n            'level': 'INFO',\n            'propagate': True,\n        },\n        'cms': {\n            'handlers': ['console'],\n            'level': 'INFO',\n            'propagate': True,\n        },\n        'rules': {\n            'handlers': ['console'],\n            'level': 'DEBUG',\n            'propagate': True,\n        },\n    }\n}\n\nSTATICFILES_FINDERS = (\n    'django.contrib.staticfiles.finders.FileSystemFinder',\n    'django.contrib.staticfiles.finders.AppDirectoriesFinder',\n    'compressor.finders.CompressorFinder',\n)\n\nCOMPRESS_CSS_FILTERS = [\n    'compressor.filters.css_default.CssAbsoluteFilter',\n    'compressor.filters.cssmin.CSSMinFilter',\n    'compressor.filters.template.TemplateFilter'\n]\nCOMPRESS_JS_FILTERS = [\n    'compressor.filters.jsmin.JSMinFilter',\n]\nCOMPRESS_PRECOMPILERS = (\n    ('module', 'compressor_toolkit.precompilers.ES6Compiler'),\n    ('css', 'compressor_toolkit.precompilers.SCSSCompiler'),\n)\nCOMPRESS_ENABLED = False\nCOMPRESS_OFFLINE = True\n\n# GVZ (Gemeindeverzeichnis) API URL\nGVZ_API_URL = \"http://gvz.integreat-app.de/api/\"\nGVZ_API_ENABLED = True\n\n# Allow access to all domains by setting the following variable to TRUE\nCORS_ORIGIN_ALLOW_ALL = True\n\n# Extend default headers with development header to differenciate dev traffic in statistics\nCORS_ALLOW_HEADERS = [\n    'accept',\n    'accept-encoding',\n    'authorization',\n    'content-type',\n    'dnt',\n    'origin',\n    'user-agent',\n    'x-csrftoken',\n    'x-requested-with',\n    'x-integreat-development',\n]\n", "path": "src/backend/settings.py"}], "after_files": [{"content": "import logging\nimport sys\n\nfrom django.conf import settings\nfrom django.apps import AppConfig\nfrom django.contrib.auth.signals import user_logged_in, user_logged_out, user_login_failed\nfrom django.dispatch import receiver\n\nlogger = logging.getLogger(__name__)\n\nclass CmsConfig(AppConfig):\n    \"\"\"\n    This class represents the Django-configuration of the backend.\n\n    See :class:`django.apps.AppConfig` for more information.\n\n    :param name: The name of the app\n    :type name: str\n    \"\"\"\n\n    name = 'cms'\n\n    def ready(self):\n        \"\"\"\n        This function gets executed exactly once each time the cms starts. We use it to check wether the secret key was\n        not changed in production mode and show an error message if this is the case.\n\n        See :meth:`django.apps.AppConfig.ready` for more information.\n        \"\"\"\n        if settings.SECRET_KEY == '-!v282$zj815_q@htaxcubylo)(l%a+k*-xi78hw*#s2@i86@_' and not settings.DEBUG:\n            logger.error(\"You are running the Integreat CMS in production mode. Change the SECRET_KEY in the settings.py!\")\n            sys.exit(1)\n\n\nauthlog = logging.getLogger(\"auth\")\n\n@receiver(user_logged_in)\ndef user_logged_in_callback(sender, request, user, **kwargs):  # pylint: disable=unused-argument\n    ip = request.META.get('REMOTE_ADDR')\n    authlog.info('login user=%s, ip=%s', user, ip)\n\n@receiver(user_logged_out)\ndef user_logged_out_callback(sender, request, user, **kwargs):  # pylint: disable=unused-argument\n    ip = request.META.get('REMOTE_ADDR')\n    authlog.info('logout user=%s, ip=%s', user, ip)\n\n@receiver(user_login_failed)\ndef user_login_failed_callback(sender, credentials, request, **kwargs):  # pylint: disable=unused-argument\n    ip = request.META.get('REMOTE_ADDR')\n    authlog.warning('login failed user=%s, ip=%s', credentials['username'], ip)\n", "path": "src/cms/apps.py"}, {"content": "\"\"\"\nDjango settings for backend project.\n\nFor more information on this file, see :doc:`topics/settings`.\nFor the full list of settings and their values, see :doc:`ref/settings`.\n\"\"\"\nimport os\n\n# Build paths inside the project like this: os.path.join(BASE_DIR, ...)\nBASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\n\n\n# Version number\nVERSION = '0.0.14'\n\n# Quick-start development settings - unsuitable for production\n# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/\n\n# SECURITY WARNING: keep the secret key used in production secret!\nSECRET_KEY = '-!v282$zj815_q@htaxcubylo)(l%a+k*-xi78hw*#s2@i86@_'\n\n# SECURITY WARNING: don't run with debug turned on in production!\nDEBUG = True\n\nALLOWED_HOSTS = [\n    'localhost',\n    '127.0.0.1',\n    '0.0.0.0'\n]\n\n# Needed for webauthn (this is a setting in case the application runs behind a proxy)\nHOSTNAME = 'localhost'\nBASE_URL = 'http://localhost:8000'\n\n# Application definition\n\nINSTALLED_APPS = [\n    'cms.apps.CmsConfig',\n    'gvz_api.apps.GvzApiConfig',\n    'django.contrib.admin',\n    'django.contrib.auth',\n    'django.contrib.contenttypes',\n    'django.contrib.messages',\n    'django.contrib.sessions',\n    'django.contrib.staticfiles',\n    'compressor',\n    'compressor_toolkit',\n    'corsheaders',\n    'widget_tweaks',\n    'easy_thumbnails',\n    'filer',\n    'mptt',\n    'rules.apps.AutodiscoverRulesConfig',\n]\n\nMIDDLEWARE = [\n    'corsheaders.middleware.CorsMiddleware',\n    'django.middleware.security.SecurityMiddleware',\n    'django.contrib.sessions.middleware.SessionMiddleware',\n    'django.middleware.locale.LocaleMiddleware',\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 = 'backend.urls'\nTHUMBNAIL_HIGH_RESOLUTION = True\n\nTEMPLATES = [\n    {\n        'BACKEND': 'django.template.backends.django.DjangoTemplates',\n        'DIRS': [],\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                'backend.context_processors.region_slug_processor',\n            ],\n            'debug': DEBUG,\n        },\n    },\n]\n\nWSGI_APPLICATION = 'backend.wsgi.application'\n\n\n# Database\n# https://docs.djangoproject.com/en/2.2/ref/settings/#databases\n\nDATABASES = {\n    'default': {\n        'ENGINE': 'django.db.backends.postgresql_psycopg2',\n        'NAME': 'integreat',\n        'USER': 'integreat',\n        'PASSWORD': 'password',\n        'HOST': 'localhost',\n        'PORT': '5432',\n    }\n}\n\n# Directory for initial database contents\n\nFIXTURE_DIRS = (\n    os.path.join(BASE_DIR, 'cms/fixtures/'),\n)\n\n# Authentication backends\n\nAUTHENTICATION_BACKENDS = (\n    'rules.permissions.ObjectPermissionBackend',\n    'django.contrib.auth.backends.ModelBackend',  # this is default\n)\n\n\n# Password validation\n# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators\n\nAUTH_PASSWORD_VALIDATORS = [\n    {\n        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',\n    },\n    {\n        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',\n    },\n    {\n        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',\n    },\n    {\n        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',\n    },\n]\n\n\n# Internationalization\n# https://docs.djangoproject.com/en/2.2/topics/i18n/\n\nLANGUAGES = (\n    ('en-us', 'English'),\n    ('de-de', 'Deutsch'),\n)\n\nLOCALE_PATHS = (\n    os.path.join(BASE_DIR, 'locale'),\n)\n\nLANGUAGE_CODE = 'de-de'\n\nTIME_ZONE = 'UTC'\n\nUSE_I18N = True\n\nUSE_L10N = True\n\nUSE_TZ = True\n\n\n# Static files (CSS, JavaScript, Images)\n# https://docs.djangoproject.com/en/2.2/howto/static-files/\n\nSTATICFILES_DIRS = [\n    os.path.join(BASE_DIR, \"../node_modules\"),\n]\nSTATIC_URL = '/static/'\nSTATIC_ROOT = os.path.join(BASE_DIR, 'cms/static/')\n\n# Login\nLOGIN_URL = '/login'\nLOGIN_REDIRECT_URL = '/'\nLOGOUT_REDIRECT_URL = '/login'\n\n# Miscellaneous\nEMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'\nCSRF_FAILURE_VIEW = 'cms.views.error_handler.csrf_failure'\n\nMEDIA_URL = '/media/'\nMEDIA_ROOT = os.path.join(BASE_DIR, 'media')\nFILER_CANONICAL_URL = 'media/'\n\nLOGGING = {\n    'version': 1,\n    'disable_existing_loggers': False,\n    'formatters': {\n        'default': {\n            'format': 'INTEGREAT CMS - %(levelname)s: %(message)s',\n        },\n        'console': {\n            'format': '%(asctime)s INTEGREAT CMS - %(levelname)s: %(message)s',\n            'datefmt': '%b %d %H:%M:%S',\n        }\n    },\n    'handlers': {\n        'console': {\n            'class': 'logging.StreamHandler',\n            'formatter': 'console'\n        },\n        'authlog': {\n            'level': 'INFO',\n            'class': 'logging.handlers.SysLogHandler',\n            'address': '/dev/log',\n            'facility': 'auth',\n            'formatter': 'default',\n        },\n        'syslog': {\n            'level': 'INFO',\n            'class': 'logging.handlers.SysLogHandler',\n            'address': '/dev/log',\n            'facility': 'syslog',\n            'formatter': 'default',\n        },\n    },\n    'loggers': {\n        'django': {\n            'handlers': ['console'],\n            'level': 'WARN',\n            'propagate': True,\n        },\n        'api': {\n            'handlers': ['console'],\n            'level': 'INFO',\n            'propagate': True,\n        },\n        'cms': {\n            'handlers': ['console'],\n            'level': 'INFO',\n            'propagate': True,\n        },\n        'rules': {\n            'handlers': ['console'],\n            'level': 'DEBUG',\n            'propagate': True,\n        },\n        'auth': {\n            'handlers': ['console', 'authlog', 'syslog'],\n            'level': 'INFO',\n        },\n    }\n}\n\nSTATICFILES_FINDERS = (\n    'django.contrib.staticfiles.finders.FileSystemFinder',\n    'django.contrib.staticfiles.finders.AppDirectoriesFinder',\n    'compressor.finders.CompressorFinder',\n)\n\nCOMPRESS_CSS_FILTERS = [\n    'compressor.filters.css_default.CssAbsoluteFilter',\n    'compressor.filters.cssmin.CSSMinFilter',\n    'compressor.filters.template.TemplateFilter'\n]\nCOMPRESS_JS_FILTERS = [\n    'compressor.filters.jsmin.JSMinFilter',\n]\nCOMPRESS_PRECOMPILERS = (\n    ('module', 'compressor_toolkit.precompilers.ES6Compiler'),\n    ('css', 'compressor_toolkit.precompilers.SCSSCompiler'),\n)\nCOMPRESS_ENABLED = False\nCOMPRESS_OFFLINE = True\n\n# GVZ (Gemeindeverzeichnis) API URL\nGVZ_API_URL = \"http://gvz.integreat-app.de/api/\"\nGVZ_API_ENABLED = True\n\n# Allow access to all domains by setting the following variable to TRUE\nCORS_ORIGIN_ALLOW_ALL = True\n\n# Extend default headers with development header to differenciate dev traffic in statistics\nCORS_ALLOW_HEADERS = [\n    'accept',\n    'accept-encoding',\n    'authorization',\n    'content-type',\n    'dnt',\n    'origin',\n    'user-agent',\n    'x-csrftoken',\n    'x-requested-with',\n    'x-integreat-development',\n]\n", "path": "src/backend/settings.py"}]}