Skip to content

Instantly share code, notes, and snippets.

@andrewp-as-is
Last active July 19, 2021 08:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewp-as-is/572dd1dfa1dccf6b56ace91607c11a12 to your computer and use it in GitHub Desktop.
Save andrewp-as-is/572dd1dfa1dccf6b56ace91607c11a12 to your computer and use it in GitHub Desktop.
Django settings SSL HTTPS
"""
https://docs.djangoproject.com/en/dev/topics/security/#ssl-https
"""
if '1' in str(os.getenv('SECURE_SSL')):
SECURE_SSL_REDIRECT = True
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
"""".env file:
SECURE_SSL=1
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment