mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-02-22 08:51:59 +00:00
Update Django settings for allowed hosts configuration
- Add dynamic ALLOWED_HOSTS configuration using environment variables - Simplify host configuration by splitting allowed hosts string - Remove redundant ALLOWED_HOSTS setting in production block
This commit is contained in:
parent
c1806f05b7
commit
166a44bfc7
@ -32,6 +32,7 @@ SECRET_KEY = config("SECRET_KEY")
|
|||||||
DEBUG = config("DEBUG", cast=bool)
|
DEBUG = config("DEBUG", cast=bool)
|
||||||
|
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = str(config("ALLOWED_HOSTS", cast=str)).split(" ")
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
INTERNAL_IPS = [
|
INTERNAL_IPS = [
|
||||||
"127.0.0.1",
|
"127.0.0.1",
|
||||||
@ -316,6 +317,7 @@ logging.config.dictConfig(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if not DEBUG:
|
if not DEBUG:
|
||||||
SECURE_SSL_REDIRECT = config("DJANGO_SECURE_SSL_REDIRECT", cast=bool)
|
SECURE_SSL_REDIRECT = config("DJANGO_SECURE_SSL_REDIRECT", cast=bool)
|
||||||
SESSION_COOKIE_SECURE = True
|
SESSION_COOKIE_SECURE = True
|
||||||
@ -326,7 +328,7 @@ if not DEBUG:
|
|||||||
CSRF_TRUSTED_ORIGINS = [config("CSRF_TRUSTED_ORIGINS")]
|
CSRF_TRUSTED_ORIGINS = [config("CSRF_TRUSTED_ORIGINS")]
|
||||||
CSRF_COOKIE_DOMAIN = config("CSRF_COOKIE_DOMAIN")
|
CSRF_COOKIE_DOMAIN = config("CSRF_COOKIE_DOMAIN")
|
||||||
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
||||||
ALLOWED_HOSTS = str(config("ALLOWED_HOSTS", cast=str)).split(" ")
|
|
||||||
|
|
||||||
EMAIL_BACKEND = (
|
EMAIL_BACKEND = (
|
||||||
"django.core.mail.backends.smtp.EmailBackend" # Replace with your preferred backend
|
"django.core.mail.backends.smtp.EmailBackend" # Replace with your preferred backend
|
||||||
|
Loading…
x
Reference in New Issue
Block a user