Skip to content

Commit

Permalink
Redirect http to https in production
Browse files Browse the repository at this point in the history
  • Loading branch information
medihack committed Jan 19, 2025
1 parent e7fd02a commit 715c1ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1
DJANGO_CSRF_TRUSTED_ORIGINS=
DJANGO_INTERNAL_IPS=127.0.0.1

# Redirect all HTTP requests to HTTPS (only used in production).
DJANGO_SECURE_SSL_REDIRECT=true

# The salt that is used for hashing tokens in the token authentication app.
# Cave, changing the salt after some tokens were already generated makes them all invalid!
TOKEN_AUTHENTICATION_SALT="your_token_authentication_salt_here"
Expand Down
2 changes: 2 additions & 0 deletions example_project/example_project/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
},
}

SECURE_SSL_REDIRECT = env.bool("DJANGO_SECURE_SSL_REDIRECT")

EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_TIMEOUT = 60
email_config = env.dj_email_url("DJANGO_EMAIL_URL")
Expand Down

0 comments on commit 715c1ab

Please sign in to comment.