15
15
# Build paths inside the project like this: BASE_DIR / 'subdir'.
16
16
BASE_DIR = Path (__file__ ).resolve ().parent .parent
17
17
18
-
19
18
# Quick-start development settings - unsuitable for production
20
19
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
21
20
25
24
# SECURITY WARNING: don't run with debug turned on in production!
26
25
DEBUG = True
27
26
28
- ALLOWED_HOSTS = []
27
+ ALLOWED_HOSTS = ["5qwlrdxd4a.execute-api.ap-southeast-2.amazonaws.com" , "localhost" ]
29
28
30
29
31
30
# Application definition
45
44
46
45
MIDDLEWARE = [
47
46
'django.middleware.security.SecurityMiddleware' ,
47
+ 'whitenoise.middleware.WhiteNoiseMiddleware' ,
48
48
'django.contrib.sessions.middleware.SessionMiddleware' ,
49
49
'django.middleware.common.CommonMiddleware' ,
50
50
'django.middleware.csrf.CsrfViewMiddleware' ,
116
116
USE_TZ = True
117
117
118
118
119
- # Static files (CSS, JavaScript, Images)
120
- # https://docs.djangoproject.com/en/4.2/howto/static-files/
121
-
122
- STATIC_URL = 'static/'
123
119
124
120
# Default primary key field type
125
121
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
130
126
GRAPH_MODELS = {
131
127
'all_applications' : False ,
132
128
'group_models' : True ,
133
- }
129
+ }
130
+
131
+ # Static files (CSS, JavaScript, Images)
132
+ # https://docs.djangoproject.com/en/4.2/howto/static-files/
133
+
134
+ STATIC_URL = 'static/'
135
+ STATIC_ROOT = str (BASE_DIR / 'staticfiles' )
136
+
137
+ # using whitenoise to simplify static resources
138
+ # ref https://whitenoise.readthedocs.io/en/latest/#quickstart-for-django-apps
139
+ STORAGES = {
140
+ # ...
141
+ "staticfiles" : {
142
+ "BACKEND" : "whitenoise.storage.CompressedManifestStaticFilesStorage" ,
143
+ },
144
+ }
145
+
146
+ SECURE_REFERRER_POLICY = "origin"
147
+ SECURE_CONTENT_TYPE_NOSNIFF = False
148
+ WHITENOISE_STATIC_PREFIX = "static/"
0 commit comments