@@ -52,8 +52,7 @@ def require_env_var(env_var: str) -> str:
52
52
# Core Settings
53
53
# ---------------------------------------------------------
54
54
SECRET_KEY = require_env_var ('SECRET_KEY' )
55
- # DEBUG = get_env_bool('DEBUG', default=False)
56
- DEBUG = True
55
+ DEBUG = get_env_bool ('DEBUG' , default = False )
57
56
58
57
# ALLOWED_HOSTS = parse_env_list("ALLOWED_HOSTS")
59
58
ALLOWED_HOSTS = ['*' ]
@@ -131,11 +130,57 @@ def require_env_var(env_var: str) -> str:
131
130
else :
132
131
# Restrict CORS origins in production
133
132
CORS_ORIGIN_ALLOW_ALL = False
134
- CORS_ALLOWED_ORIGINS = parse_env_list ("CORS_ALLOWED_ORIGINS" )
135
- CORS_ORIGIN_REGEX_WHITELIST = parse_env_list ("CORS_ORIGIN_REGEX_WHITELIST" )
133
+ CORS_ALLOWED_ORIGINS = [
134
+ "https://staging-dot-airqo-frontend.appspot.com" ,
135
+ "https://staging.airqo.net" ,
136
+ "https://airqo.net" ,
137
+ "https://airqo.africa" ,
138
+ "https://airqo.org" ,
139
+ "https://airqo.mak.ac.ug" ,
140
+ "http://127.0.0.1:8000" ,
141
+ "http://localhost:3000" ,
142
+ "https://staging-platform.airqo.net" ,
143
+ "https://staging-analytics.airqo.net" ,
144
+ "https://analytics.airqo.net" ,
145
+ "https://platform.airqo.net" ,
146
+ ]
147
+ CORS_ORIGIN_REGEX_WHITELIST = [
148
+ # Matches subdomains under airqo.net, airqo.africa, airqo.org, airqo.io
149
+ r"^https://[a-zA-Z0-9_\-]+\.airqo\.(net|africa|org|io)$" ,
150
+ # Matches airqo.africa, airqo.org, and airqo.mak.ac.ug
151
+ r"^https://airqo\.(africa|org|mak\.ac\.ug)$" ,
152
+ # Matches staging-dot-airqo-frontend.appspot.com
153
+ r"^https://staging-dot-airqo-frontend\.appspot\.com$" ,
154
+ r"^https://staging-platform\.airqo\.net$" , # Matches staging-platform.airqo.net
155
+ # Matches staging-analytics.airqo.net
156
+ r"^https://staging-analytics\.airqo\.net$" ,
157
+ r"^https://analytics\.airqo\.net$" , # Matches analytics.airqo.net
158
+ r"^https://platform\.airqo\.net$" , # Matches platform.airqo.net
159
+ # Matches any subpath under https://platform.airqo.net/website/admin
160
+ r"^https://platform\.airqo\.net/website/admin.*$" ,
161
+ # Matches any subpath under https://staging-platform.airqo.net/website/admin
162
+ r"^https://staging-platform\.airqo\.net/website/admin.*$" ,
163
+ ]
136
164
137
165
# Trust specific origins for CSRF protection in production
138
- CSRF_TRUSTED_ORIGINS = parse_env_list ("CSRF_TRUSTED_ORIGINS" )
166
+ # CSRF_TRUSTED_ORIGINS = parse_env_list("CSRF_TRUSTED_ORIGINS")
167
+ CSRF_TRUSTED_ORIGINS = [
168
+ "https://staging-dot-airqo-frontend.appspot.com" ,
169
+ "https://staging.airqo.net" ,
170
+ "https://airqo.net" ,
171
+ "https://airqo.africa" ,
172
+ "https://airqo.org" ,
173
+ "https://airqo.mak.ac.ug" ,
174
+ "http://127.0.0.1:8000" ,
175
+ "http://localhost:3000" ,
176
+ "https://*.cloudshell.dev" ,
177
+ "https://staging-platform.airqo.net" ,
178
+ "https://staging-analytics.airqo.net" ,
179
+ "https://analytics.airqo.net" ,
180
+ "https://platform.airqo.net" ,
181
+ "https://website-trigger-3-website-preview-w7kzhvlewq-ew.a.run.app" ,
182
+ ]
183
+
139
184
140
185
# Security settings
141
186
CSRF_COOKIE_SECURE = not DEBUG
0 commit comments