We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
 Fix CSRF middleware
There is a [TODO in `settings.py` to 'fix the CSRF middleware'](https://github.com/CiviWiki/OpenCiviWiki/blob/dev/civiwiki/settings.py#L60). This issue is a placeholder to make sure we resolve the issue with CSRF middleware.

What is the issue that prevents us from using CSRF?

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `civiwiki/settings.py`
Content:
```
1 """
2 Django settings for civiwiki project.
3 Darius Calliet May 12, 2016
4 
5 Production settings file to select proper environment variables.
6 """
7 import os
8 
9 from django.core.exceptions import ImproperlyConfigured
10 import dj_database_url
11 
12 
13 def get_env_variable(environment_variable, optional=False):
14     """Get the environment variable or return exception"""
15     try:
16         return os.environ[environment_variable]
17     except KeyError:
18         if optional:
19             return ''
20         else:
21             error = "Environment variable '{ev}' not found.".format(ev=environment_variable)
22             raise ImproperlyConfigured(error)
23 
24 
25 # Devlopment Environment Control
26 DEBUG = 'DEBUG' in os.environ
27 
28 if 'DJANGO_HOST' in os.environ:
29     DJANGO_HOST = get_env_variable("DJANGO_HOST")
30 else:
31     DJANGO_HOST = 'LOCALHOST'
32 
33 
34 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
35 SECRET_KEY = get_env_variable("DJANGO_SECRET_KEY")
36 ALLOWED_HOSTS = [".herokuapp.com", ".civiwiki.org", "127.0.0.1", "localhost"]
37 
38 
39 INSTALLED_APPS = (
40     'django.contrib.admin',
41     'django.contrib.auth',
42     'django.contrib.contenttypes',
43     'django.contrib.sessions',
44     'django.contrib.messages',
45     'django.contrib.staticfiles',
46     'storages',
47     'channels',
48     'civiwiki',
49     'api',
50     'authentication',
51     'frontend_views',
52     'notifications',
53     'legislation',
54 )
55 
56 
57 MIDDLEWARE_CLASSES = (
58     'django.contrib.sessions.middleware.SessionMiddleware',
59     'django.middleware.common.CommonMiddleware',
60     # 'django.middleware.csrf.CsrfViewMiddleware', TODO: fix eventually
61     'django.contrib.auth.middleware.AuthenticationMiddleware',
62     'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
63     'django.contrib.messages.middleware.MessageMiddleware',
64     'django.middleware.clickjacking.XFrameOptionsMiddleware',
65     'django.middleware.security.SecurityMiddleware',
66 )
67 
68 
69 CORS_ORIGIN_ALLOW_ALL = True
70 ROOT_URLCONF = 'civiwiki.urls'
71 LOGIN_URL = '/login'
72 
73 
74 # SSL Setup
75 if DJANGO_HOST is not 'LOCALHOST':
76     SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
77     SECURE_SSL_REDIRECT = True
78     SESSION_COOKIE_SECURE = True
79     CSRF_COOKIE_SECURE = True
80 
81 
82 # Internationalization & Localization
83 LANGUAGE_CODE = 'en-us'
84 TIME_ZONE = 'UTC'
85 USE_I18N = True
86 USE_L10N = True
87 USE_TZ = True
88 
89 
90 TEMPLATES = [
91     {
92         'BACKEND': 'django.template.backends.django.DjangoTemplates',
93         'DIRS': [os.path.join(BASE_DIR, "webapp/templates")], #TODO: Add non-webapp template directory
94         'APP_DIRS': True,
95         'OPTIONS': {
96             'context_processors': [
97                 'django.template.context_processors.debug',
98                 'django.template.context_processors.request',
99                 'django.contrib.auth.context_processors.auth',
100                 'django.contrib.messages.context_processors.messages',
101             ],
102         },
103     },
104 ]
105 
106 
107 WSGI_APPLICATION = 'civiwiki.wsgi.application'
108 
109 
110 # Apex Contact for Production Errors
111 ADMINS = [('Development Team', 'dev@civiwiki.org')]
112 
113 
114 # API keys
115 SUNLIGHT_API_KEY = get_env_variable("SUNLIGHT_API_KEY")
116 GOOGLE_API_KEY = get_env_variable("GOOGLE_MAP_API_KEY")
117 
118 # Channels Setup
119 if 'REDIS_URL' in os.environ:
120     REDIS_URL = get_env_variable("REDIS_URL")
121 else:
122     REDIS_URL = 'redis://localhost:6379'
123 CHANNEL_LAYERS = {
124     "default": {
125         "BACKEND": "asgi_redis.RedisChannelLayer",
126         "CONFIG": {
127             "hosts": [REDIS_URL],
128         },
129         "ROUTING": "civiwiki.routing.channel_routing",
130     },
131 }
132 
133 
134 # Celery Task Runner Setup
135 CELERY_BROKER_URL = REDIS_URL + '/0'
136 CELERY_RESULT_BACKEND = CELERY_BROKER_URL
137 CELERY_ACCEPT_CONTENT = ['application/json']
138 CELERY_TASK_SERIALIZER = 'json'
139 CELERY_RESULT_SERIALIZER = 'json'
140 CELERY_TIME_ZONE = TIME_ZONE
141 
142 
143 # AWS S3 Setup
144 if 'AWS_STORAGE_BUCKET_NAME' not in os.environ:
145     MEDIA_URL = '/media/'
146     MEDIA_ROOT = os.path.join(BASE_DIR, "media")
147 else:
148     AWS_STORAGE_BUCKET_NAME = get_env_variable("AWS_STORAGE_BUCKET_NAME")
149     AWS_S3_ACCESS_KEY_ID = get_env_variable("AWS_S3_ACCESS_KEY_ID")
150     AWS_S3_SECRET_ACCESS_KEY = get_env_variable("AWS_S3_SECRET_ACCESS_KEY")
151     DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
152     AWS_S3_SECURE_URLS = False
153     AWS_QUERYSTRING_AUTH = False
154 
155 STATIC_URL = '/static/'
156 STATICFILES_DIRS = (
157     os.path.join(BASE_DIR, 'webapp/static'),
158 )
159 STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
160 
161 
162 # Database
163 if 'CIVIWIKI_LOCAL_NAME' not in os.environ:
164     STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
165 
166     DATABASES = {
167         'default': dj_database_url.parse(get_env_variable("DATABASE_URL"))
168     }
169 else:
170     DATABASES = {
171         'default': {
172             'HOST': 'localhost',
173             'PORT': '5432',
174             'NAME': get_env_variable("CIVIWIKI_LOCAL_NAME"),
175             'ENGINE': 'django.db.backends.postgresql_psycopg2',
176             'USER': get_env_variable("CIVIWIKI_LOCAL_USERNAME"),
177             'PASSWORD': get_env_variable("CIVIWIKI_LOCAL_PASSWORD"),
178         },
179     }
180 
181 
182 # Email Backend Setup
183 if 'EMAIL_HOST' not in os.environ:
184     EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
185     EMAIL_HOST_USER = "test@civiwiki.org"
186 else:
187     EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
188     EMAIL_HOST = get_env_variable("EMAIL_HOST")
189     EMAIL_PORT = get_env_variable("EMAIL_PORT")
190     EMAIL_HOST_USER = get_env_variable("EMAIL_HOST_USER")
191     EMAIL_HOST_PASSWORD = get_env_variable("EMAIL_HOST_PASSWORD")
192     EMAIL_USE_SSL = True
193     DEFAULT_FROM_EMAIL = EMAIL_HOST
194 
195 
196 # Notification API Settings
197 NOTIFICATIONS_SOFT_DELETE = True
198 NOTIFICATIONS_USE_JSONFIELD = True
199
```
--- 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/civiwiki/settings.py b/civiwiki/settings.py
--- a/civiwiki/settings.py
+++ b/civiwiki/settings.py
@@ -57,7 +57,7 @@
 MIDDLEWARE_CLASSES = (
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.middleware.common.CommonMiddleware',
-    # 'django.middleware.csrf.CsrfViewMiddleware', TODO: fix eventually
+    'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
@@ -66,6 +66,8 @@
 )
 
 
+CSRF_USE_SESSIONS = True # Store the CSRF token in the users session instead of in a cookie
+
 CORS_ORIGIN_ALLOW_ALL = True
 ROOT_URLCONF = 'civiwiki.urls'
 LOGIN_URL = '/login'

{"golden_diff": "diff --git a/civiwiki/settings.py b/civiwiki/settings.py\n--- a/civiwiki/settings.py\n+++ b/civiwiki/settings.py\n@@ -57,7 +57,7 @@\n MIDDLEWARE_CLASSES = (\n     'django.contrib.sessions.middleware.SessionMiddleware',\n     'django.middleware.common.CommonMiddleware',\n-    # 'django.middleware.csrf.CsrfViewMiddleware', TODO: fix eventually\n+    'django.middleware.csrf.CsrfViewMiddleware',\n     'django.contrib.auth.middleware.AuthenticationMiddleware',\n     'django.contrib.auth.middleware.SessionAuthenticationMiddleware',\n     'django.contrib.messages.middleware.MessageMiddleware',\n@@ -66,6 +66,8 @@\n )\n \n \n+CSRF_USE_SESSIONS = True # Store the CSRF token in the users session instead of in a cookie\n+\n CORS_ORIGIN_ALLOW_ALL = True\n ROOT_URLCONF = 'civiwiki.urls'\n LOGIN_URL = '/login'\n", "issue": " Fix CSRF middleware\nThere is a [TODO in `settings.py` to 'fix the CSRF middleware'](https://github.com/CiviWiki/OpenCiviWiki/blob/dev/civiwiki/settings.py#L60). This issue is a placeholder to make sure we resolve the issue with CSRF middleware.\r\n\r\nWhat is the issue that prevents us from using CSRF?\n", "before_files": [{"content": "\"\"\"\nDjango settings for civiwiki project.\nDarius Calliet May 12, 2016\n\nProduction settings file to select proper environment variables.\n\"\"\"\nimport os\n\nfrom django.core.exceptions import ImproperlyConfigured\nimport dj_database_url\n\n\ndef get_env_variable(environment_variable, optional=False):\n    \"\"\"Get the environment variable or return exception\"\"\"\n    try:\n        return os.environ[environment_variable]\n    except KeyError:\n        if optional:\n            return ''\n        else:\n            error = \"Environment variable '{ev}' not found.\".format(ev=environment_variable)\n            raise ImproperlyConfigured(error)\n\n\n# Devlopment Environment Control\nDEBUG = 'DEBUG' in os.environ\n\nif 'DJANGO_HOST' in os.environ:\n    DJANGO_HOST = get_env_variable(\"DJANGO_HOST\")\nelse:\n    DJANGO_HOST = 'LOCALHOST'\n\n\nBASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\nSECRET_KEY = get_env_variable(\"DJANGO_SECRET_KEY\")\nALLOWED_HOSTS = [\".herokuapp.com\", \".civiwiki.org\", \"127.0.0.1\", \"localhost\"]\n\n\nINSTALLED_APPS = (\n    'django.contrib.admin',\n    'django.contrib.auth',\n    'django.contrib.contenttypes',\n    'django.contrib.sessions',\n    'django.contrib.messages',\n    'django.contrib.staticfiles',\n    'storages',\n    'channels',\n    'civiwiki',\n    'api',\n    'authentication',\n    'frontend_views',\n    'notifications',\n    'legislation',\n)\n\n\nMIDDLEWARE_CLASSES = (\n    'django.contrib.sessions.middleware.SessionMiddleware',\n    'django.middleware.common.CommonMiddleware',\n    # 'django.middleware.csrf.CsrfViewMiddleware', TODO: fix eventually\n    'django.contrib.auth.middleware.AuthenticationMiddleware',\n    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',\n    'django.contrib.messages.middleware.MessageMiddleware',\n    'django.middleware.clickjacking.XFrameOptionsMiddleware',\n    'django.middleware.security.SecurityMiddleware',\n)\n\n\nCORS_ORIGIN_ALLOW_ALL = True\nROOT_URLCONF = 'civiwiki.urls'\nLOGIN_URL = '/login'\n\n\n# SSL Setup\nif DJANGO_HOST is not 'LOCALHOST':\n    SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')\n    SECURE_SSL_REDIRECT = True\n    SESSION_COOKIE_SECURE = True\n    CSRF_COOKIE_SECURE = True\n\n\n# Internationalization & Localization\nLANGUAGE_CODE = 'en-us'\nTIME_ZONE = 'UTC'\nUSE_I18N = True\nUSE_L10N = True\nUSE_TZ = True\n\n\nTEMPLATES = [\n    {\n        'BACKEND': 'django.template.backends.django.DjangoTemplates',\n        'DIRS': [os.path.join(BASE_DIR, \"webapp/templates\")], #TODO: Add non-webapp template directory\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            ],\n        },\n    },\n]\n\n\nWSGI_APPLICATION = 'civiwiki.wsgi.application'\n\n\n# Apex Contact for Production Errors\nADMINS = [('Development Team', 'dev@civiwiki.org')]\n\n\n# API keys\nSUNLIGHT_API_KEY = get_env_variable(\"SUNLIGHT_API_KEY\")\nGOOGLE_API_KEY = get_env_variable(\"GOOGLE_MAP_API_KEY\")\n\n# Channels Setup\nif 'REDIS_URL' in os.environ:\n    REDIS_URL = get_env_variable(\"REDIS_URL\")\nelse:\n    REDIS_URL = 'redis://localhost:6379'\nCHANNEL_LAYERS = {\n    \"default\": {\n        \"BACKEND\": \"asgi_redis.RedisChannelLayer\",\n        \"CONFIG\": {\n            \"hosts\": [REDIS_URL],\n        },\n        \"ROUTING\": \"civiwiki.routing.channel_routing\",\n    },\n}\n\n\n# Celery Task Runner Setup\nCELERY_BROKER_URL = REDIS_URL + '/0'\nCELERY_RESULT_BACKEND = CELERY_BROKER_URL\nCELERY_ACCEPT_CONTENT = ['application/json']\nCELERY_TASK_SERIALIZER = 'json'\nCELERY_RESULT_SERIALIZER = 'json'\nCELERY_TIME_ZONE = TIME_ZONE\n\n\n# AWS S3 Setup\nif 'AWS_STORAGE_BUCKET_NAME' not in os.environ:\n    MEDIA_URL = '/media/'\n    MEDIA_ROOT = os.path.join(BASE_DIR, \"media\")\nelse:\n    AWS_STORAGE_BUCKET_NAME = get_env_variable(\"AWS_STORAGE_BUCKET_NAME\")\n    AWS_S3_ACCESS_KEY_ID = get_env_variable(\"AWS_S3_ACCESS_KEY_ID\")\n    AWS_S3_SECRET_ACCESS_KEY = get_env_variable(\"AWS_S3_SECRET_ACCESS_KEY\")\n    DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'\n    AWS_S3_SECURE_URLS = False\n    AWS_QUERYSTRING_AUTH = False\n\nSTATIC_URL = '/static/'\nSTATICFILES_DIRS = (\n    os.path.join(BASE_DIR, 'webapp/static'),\n)\nSTATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')\n\n\n# Database\nif 'CIVIWIKI_LOCAL_NAME' not in os.environ:\n    STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'\n\n    DATABASES = {\n        'default': dj_database_url.parse(get_env_variable(\"DATABASE_URL\"))\n    }\nelse:\n    DATABASES = {\n        'default': {\n            'HOST': 'localhost',\n            'PORT': '5432',\n            'NAME': get_env_variable(\"CIVIWIKI_LOCAL_NAME\"),\n            'ENGINE': 'django.db.backends.postgresql_psycopg2',\n            'USER': get_env_variable(\"CIVIWIKI_LOCAL_USERNAME\"),\n            'PASSWORD': get_env_variable(\"CIVIWIKI_LOCAL_PASSWORD\"),\n        },\n    }\n\n\n# Email Backend Setup\nif 'EMAIL_HOST' not in os.environ:\n    EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'\n    EMAIL_HOST_USER = \"test@civiwiki.org\"\nelse:\n    EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'\n    EMAIL_HOST = get_env_variable(\"EMAIL_HOST\")\n    EMAIL_PORT = get_env_variable(\"EMAIL_PORT\")\n    EMAIL_HOST_USER = get_env_variable(\"EMAIL_HOST_USER\")\n    EMAIL_HOST_PASSWORD = get_env_variable(\"EMAIL_HOST_PASSWORD\")\n    EMAIL_USE_SSL = True\n    DEFAULT_FROM_EMAIL = EMAIL_HOST\n\n\n# Notification API Settings\nNOTIFICATIONS_SOFT_DELETE = True\nNOTIFICATIONS_USE_JSONFIELD = True\n", "path": "civiwiki/settings.py"}], "after_files": [{"content": "\"\"\"\nDjango settings for civiwiki project.\nDarius Calliet May 12, 2016\n\nProduction settings file to select proper environment variables.\n\"\"\"\nimport os\n\nfrom django.core.exceptions import ImproperlyConfigured\nimport dj_database_url\n\n\ndef get_env_variable(environment_variable, optional=False):\n    \"\"\"Get the environment variable or return exception\"\"\"\n    try:\n        return os.environ[environment_variable]\n    except KeyError:\n        if optional:\n            return ''\n        else:\n            error = \"Environment variable '{ev}' not found.\".format(ev=environment_variable)\n            raise ImproperlyConfigured(error)\n\n\n# Devlopment Environment Control\nDEBUG = 'DEBUG' in os.environ\n\nif 'DJANGO_HOST' in os.environ:\n    DJANGO_HOST = get_env_variable(\"DJANGO_HOST\")\nelse:\n    DJANGO_HOST = 'LOCALHOST'\n\n\nBASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\nSECRET_KEY = get_env_variable(\"DJANGO_SECRET_KEY\")\nALLOWED_HOSTS = [\".herokuapp.com\", \".civiwiki.org\", \"127.0.0.1\", \"localhost\"]\n\n\nINSTALLED_APPS = (\n    'django.contrib.admin',\n    'django.contrib.auth',\n    'django.contrib.contenttypes',\n    'django.contrib.sessions',\n    'django.contrib.messages',\n    'django.contrib.staticfiles',\n    'storages',\n    'channels',\n    'civiwiki',\n    'api',\n    'authentication',\n    'frontend_views',\n    'notifications',\n    'legislation',\n)\n\n\nMIDDLEWARE_CLASSES = (\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.auth.middleware.SessionAuthenticationMiddleware',\n    'django.contrib.messages.middleware.MessageMiddleware',\n    'django.middleware.clickjacking.XFrameOptionsMiddleware',\n    'django.middleware.security.SecurityMiddleware',\n)\n\n\nCSRF_USE_SESSIONS = True # Store the CSRF token in the users session instead of in a cookie\n\nCORS_ORIGIN_ALLOW_ALL = True\nROOT_URLCONF = 'civiwiki.urls'\nLOGIN_URL = '/login'\n\n\n# SSL Setup\nif DJANGO_HOST is not 'LOCALHOST':\n    SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')\n    SECURE_SSL_REDIRECT = True\n    SESSION_COOKIE_SECURE = True\n    CSRF_COOKIE_SECURE = True\n\n\n# Internationalization & Localization\nLANGUAGE_CODE = 'en-us'\nTIME_ZONE = 'UTC'\nUSE_I18N = True\nUSE_L10N = True\nUSE_TZ = True\n\n\nTEMPLATES = [\n    {\n        'BACKEND': 'django.template.backends.django.DjangoTemplates',\n        'DIRS': [os.path.join(BASE_DIR, \"webapp/templates\")], #TODO: Add non-webapp template directory\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            ],\n        },\n    },\n]\n\n\nWSGI_APPLICATION = 'civiwiki.wsgi.application'\n\n\n# Apex Contact for Production Errors\nADMINS = [('Development Team', 'dev@civiwiki.org')]\n\n\n# API keys\nSUNLIGHT_API_KEY = get_env_variable(\"SUNLIGHT_API_KEY\")\nGOOGLE_API_KEY = get_env_variable(\"GOOGLE_MAP_API_KEY\")\n\n# Channels Setup\nif 'REDIS_URL' in os.environ:\n    REDIS_URL = get_env_variable(\"REDIS_URL\")\nelse:\n    REDIS_URL = 'redis://localhost:6379'\nCHANNEL_LAYERS = {\n    \"default\": {\n        \"BACKEND\": \"asgi_redis.RedisChannelLayer\",\n        \"CONFIG\": {\n            \"hosts\": [REDIS_URL],\n        },\n        \"ROUTING\": \"civiwiki.routing.channel_routing\",\n    },\n}\n\n\n# Celery Task Runner Setup\nCELERY_BROKER_URL = REDIS_URL + '/0'\nCELERY_RESULT_BACKEND = CELERY_BROKER_URL\nCELERY_ACCEPT_CONTENT = ['application/json']\nCELERY_TASK_SERIALIZER = 'json'\nCELERY_RESULT_SERIALIZER = 'json'\nCELERY_TIME_ZONE = TIME_ZONE\n\n\n# AWS S3 Setup\nif 'AWS_STORAGE_BUCKET_NAME' not in os.environ:\n    MEDIA_URL = '/media/'\n    MEDIA_ROOT = os.path.join(BASE_DIR, \"media\")\nelse:\n    AWS_STORAGE_BUCKET_NAME = get_env_variable(\"AWS_STORAGE_BUCKET_NAME\")\n    AWS_S3_ACCESS_KEY_ID = get_env_variable(\"AWS_S3_ACCESS_KEY_ID\")\n    AWS_S3_SECRET_ACCESS_KEY = get_env_variable(\"AWS_S3_SECRET_ACCESS_KEY\")\n    DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'\n    AWS_S3_SECURE_URLS = False\n    AWS_QUERYSTRING_AUTH = False\n\nSTATIC_URL = '/static/'\nSTATICFILES_DIRS = (\n    os.path.join(BASE_DIR, 'webapp/static'),\n)\nSTATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')\n\n\n# Database\nif 'CIVIWIKI_LOCAL_NAME' not in os.environ:\n    STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'\n\n    DATABASES = {\n        'default': dj_database_url.parse(get_env_variable(\"DATABASE_URL\"))\n    }\nelse:\n    DATABASES = {\n        'default': {\n            'HOST': 'localhost',\n            'PORT': '5432',\n            'NAME': get_env_variable(\"CIVIWIKI_LOCAL_NAME\"),\n            'ENGINE': 'django.db.backends.postgresql_psycopg2',\n            'USER': get_env_variable(\"CIVIWIKI_LOCAL_USERNAME\"),\n            'PASSWORD': get_env_variable(\"CIVIWIKI_LOCAL_PASSWORD\"),\n        },\n    }\n\n\n# Email Backend Setup\nif 'EMAIL_HOST' not in os.environ:\n    EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'\n    EMAIL_HOST_USER = \"test@civiwiki.org\"\nelse:\n    EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'\n    EMAIL_HOST = get_env_variable(\"EMAIL_HOST\")\n    EMAIL_PORT = get_env_variable(\"EMAIL_PORT\")\n    EMAIL_HOST_USER = get_env_variable(\"EMAIL_HOST_USER\")\n    EMAIL_HOST_PASSWORD = get_env_variable(\"EMAIL_HOST_PASSWORD\")\n    EMAIL_USE_SSL = True\n    DEFAULT_FROM_EMAIL = EMAIL_HOST\n\n\n# Notification API Settings\nNOTIFICATIONS_SOFT_DELETE = True\nNOTIFICATIONS_USE_JSONFIELD = True\n", "path": "civiwiki/settings.py"}]}