Skip to content

Commit e7e6ada

Browse files
author
Kátia Nakamura
committed
settings: set SECURE_SSL_REDIRECT as True if not TESTING
1 parent ee4d1a2 commit e7e6ada

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pyconbalkan/settings.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import os
1414

1515
import raven
16+
import sys
1617
from decouple import config
1718
from dj_database_url import parse as dburl
1819

@@ -162,15 +163,18 @@
162163
META_DEFAULT_KEYWORDS = ['PyCon', 'Balkan']
163164
META_SITE_DOMAIN = 'https://pyconbalkan.com/'
164165

166+
# Are we testing? i.e. was this code run via "manage.py test"
167+
TESTING = len(sys.argv) > 1 and sys.argv[1] == 'test'
168+
# SSL redirect
169+
SECURE_SSL_REDIRECT = False if TESTING else True
170+
165171
if DEBUG:
166172
# Storage
167173
DEFAULT_FILE_STORAGE = "pyconbalkan.core.storage.LocalStorage"
168174
# Email
169175
EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
170176
EMAIL_FILE_PATH = '/tmp/app-emails'
171177
else:
172-
# SSL redirect
173-
SECURE_SSL_REDIRECT = True
174178
# Storage
175179
DEFAULT_FILE_STORAGE = "pyconbalkan.core.storage.S3Storage"
176180
# Email

0 commit comments

Comments
 (0)