Skip to content

Commit

Permalink
Adding argument to test with DEBUG=False but locally with STAGE=True …
Browse files Browse the repository at this point in the history
…to prevent SSL issues.
  • Loading branch information
morganekmefjord committed Dec 12, 2024
1 parent 8388390 commit 4b18f24
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions ptp/ptp/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@

ALLOWED_HOSTS = ['*', 'localhost']

CSRF_TRUSTED_ORIGINS=['https://ptp-inference.serve.scilifelab.se']

CSRF_TRUSTED_ORIGINS=['http://localhost:8000']
if os.environ.get('CSRF_TRUSTED_ORIGINS', False):
CSRF_TRUSTED_ORIGINS = os.environ.get('CSRF_TRUSTED_ORIGINS').split(',')



Expand All @@ -44,7 +45,7 @@
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
#'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'ptp.urls'
Expand Down Expand Up @@ -153,9 +154,12 @@

SITE_URL = os.environ.get('EMAIL_DOMAIN','https://yourdomain.com')

# Security settings
SECURE_BROWSER_XSS_FILTER = True
X_FRAME_OPTIONS = 'DENY'
SECURE_SSL_REDIRECT = not DEBUG
CSRF_COOKIE_SECURE = not DEBUG
SESSION_COOKIE_SECURE = not DEBUG
STAGE_ENV = os.environ.get('STAGE', False)

if not STAGE_ENV:
# Security settings
SECURE_BROWSER_XSS_FILTER = True
X_FRAME_OPTIONS = 'DENY'
SECURE_SSL_REDIRECT = not DEBUG
CSRF_COOKIE_SECURE = not DEBUG
SESSION_COOKIE_SECURE = not DEBUG

0 comments on commit 4b18f24

Please sign in to comment.