1
1
"""
2
2
This file contains all the settings Django supports out of the box.
3
- https://docs.djangoproject.com/en/3 .2/ref/settings/
3
+ https://docs.djangoproject.com/en/4 .2/ref/settings/
4
4
"""
5
5
6
6
import json
28
28
DEBUG = bool (int (os .getenv ("DEBUG" , "1" )))
29
29
30
30
# Quick-start development settings - unsuitable for production
31
- # See https://docs.djangoproject.com/en/3 .2/howto/deployment/checklist/
31
+ # See https://docs.djangoproject.com/en/4 .2/howto/deployment/checklist/
32
32
33
33
ALLOWED_HOSTS = ["*" ]
34
34
35
35
# Database
36
- # https://docs.djangoproject.com/en/3 .2/ref/settings/#databases
36
+ # https://docs.djangoproject.com/en/4 .2/ref/settings/#databases
37
37
38
38
39
39
def get_databases ():
@@ -106,12 +106,12 @@ def get_databases():
106
106
SECRET_KEY = os .getenv ("SECRET_KEY" , "replace-me" )
107
107
108
108
# Auth
109
- # https://docs.djangoproject.com/en/3 .2/topics/auth/default/
109
+ # https://docs.djangoproject.com/en/4 .2/topics/auth/default/
110
110
111
111
LOGIN_URL = f"{ SERVICE_BASE_URL } /session/expired/"
112
112
113
113
# Authentication backends
114
- # https://docs.djangoproject.com/en/3 .2/ref/settings/#authentication-backends
114
+ # https://docs.djangoproject.com/en/4 .2/ref/settings/#authentication-backends
115
115
116
116
AUTHENTICATION_BACKENDS = [
117
117
"codeforlife.user.auth.backends.EmailBackend" ,
@@ -122,7 +122,7 @@ def get_databases():
122
122
]
123
123
124
124
# Sessions
125
- # https://docs.djangoproject.com/en/3 .2/topics/http/sessions/
125
+ # https://docs.djangoproject.com/en/4 .2/topics/http/sessions/
126
126
127
127
SESSION_ENGINE = "codeforlife.user.models.session"
128
128
SESSION_SAVE_EVERY_REQUEST = True
@@ -135,14 +135,14 @@ def get_databases():
135
135
SESSION_COOKIE_DOMAIN = os .getenv ("SESSION_COOKIE_DOMAIN" , "localhost" )
136
136
137
137
# Security
138
- # https://docs.djangoproject.com/en/3 .2/topics/security/
138
+ # https://docs.djangoproject.com/en/4 .2/topics/security/
139
139
140
140
SECURE_CONTENT_TYPE_NOSNIFF = True
141
141
SECURE_BROWSER_XSS_FILTER = True
142
142
SECURE_REFERRER_POLICY = "strict-origin-when-cross-origin"
143
143
144
144
# Internationalization
145
- # https://docs.djangoproject.com/en/3 .2/topics/i18n/
145
+ # https://docs.djangoproject.com/en/4 .2/topics/i18n/
146
146
147
147
LANGUAGE_CODE = "en-gb"
148
148
LANGUAGES = [("en-gb" , _ ("English" ))]
@@ -152,12 +152,12 @@ def get_databases():
152
152
USE_TZ = True
153
153
154
154
# Default primary key field type
155
- # https://docs.djangoproject.com/en/3 .2/ref/settings/#default-auto-field
155
+ # https://docs.djangoproject.com/en/4 .2/ref/settings/#default-auto-field
156
156
157
157
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
158
158
159
159
# CSRF
160
- # https://docs.djangoproject.com/en/3 .2/ref/csrf/
160
+ # https://docs.djangoproject.com/en/4 .2/ref/csrf/
161
161
162
162
CSRF_COOKIE_NAME = f"{ SERVICE_NAME } _csrftoken"
163
163
CSRF_COOKIE_DOMAIN = os .getenv ("CSRF_COOKIE_DOMAIN" , "localhost" )
@@ -166,7 +166,7 @@ def get_databases():
166
166
CSRF_COOKIE_SECURE = True
167
167
168
168
# Logging
169
- # https://docs.djangoproject.com/en/3 .2/topics/logging/
169
+ # https://docs.djangoproject.com/en/4 .2/topics/logging/
170
170
171
171
LOGGING = {
172
172
"version" : 1 ,
@@ -194,17 +194,17 @@ def get_databases():
194
194
}
195
195
196
196
# URLs
197
- # https://docs.djangoproject.com/en/3 .2/ref/settings/#root-urlconf
197
+ # https://docs.djangoproject.com/en/4 .2/ref/settings/#root-urlconf
198
198
199
199
ROOT_URLCONF = "api.urls"
200
200
201
201
# App
202
- # https://docs.djangoproject.com/en/3 .2/ref/settings/#wsgi-application
202
+ # https://docs.djangoproject.com/en/4 .2/ref/settings/#wsgi-application
203
203
204
204
WSGI_APPLICATION = "application.app"
205
205
206
206
# Password validation
207
- # https://docs.djangoproject.com/en/3 .2/ref/settings/#auth-password-validators
207
+ # https://docs.djangoproject.com/en/4 .2/ref/settings/#auth-password-validators
208
208
209
209
# TODO: compare Django's default common password validator with our own and
210
210
# decide which to keep
@@ -232,7 +232,7 @@ def get_databases():
232
232
# pylint: enable=line-too-long
233
233
234
234
# Installed Apps
235
- # https://docs.djangoproject.com/en/3 .2/ref/settings/#installed-apps
235
+ # https://docs.djangoproject.com/en/4 .2/ref/settings/#installed-apps
236
236
237
237
INSTALLED_APPS = [
238
238
"django.contrib.admin" ,
@@ -255,13 +255,13 @@ def get_databases():
255
255
]
256
256
257
257
# Static files (CSS, JavaScript, Images)
258
- # https://docs.djangoproject.com/en/3 .2/howto/static-files/
258
+ # https://docs.djangoproject.com/en/4 .2/howto/static-files/
259
259
260
260
STATIC_ROOT = SERVICE_BASE_DIR / "static"
261
261
STATIC_URL = os .getenv ("STATIC_URL" , "/static/" )
262
262
263
263
# Templates
264
- # https://docs.djangoproject.com/en/3 .2/ref/templates/
264
+ # https://docs.djangoproject.com/en/4 .2/ref/templates/
265
265
266
266
TEMPLATES = [
267
267
{
@@ -280,7 +280,7 @@ def get_databases():
280
280
]
281
281
282
282
# File storage
283
- # https://docs.djangoproject.com/en/3 .2/topics/files/#file-storage
283
+ # https://docs.djangoproject.com/en/4 .2/topics/files/#file-storage
284
284
285
285
DEFAULT_FILE_STORAGE = (
286
286
"django.core.files.storage.FileSystemStorage"
0 commit comments