Work around script prefix problem in stronghold

This commit is contained in:
Sunil Mohan Adapa 2016-08-11 09:18:06 +05:30 committed by James Valleroy
parent f19ad2b2cb
commit 0856d7b090
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -197,6 +197,13 @@ def configure_django():
if cfg.secure_proxy_ssl_header:
secure_proxy_ssl_header = (cfg.secure_proxy_ssl_header, 'https')
# XXX: We want use STRONGHOLD_PUBLIC_NAMED_URLS, however, due to a
# bug in stronghold, it compares request.path_info with reversed
# URLs. This leads to a mismatch when script_prefix is set.
# Remove this hack once the bug is fixed. See:
# https://github.com/mgrouchy/django-stronghold/issues/52
public_urls = ('/accounts/login/', '/accounts/logout/')
django.conf.settings.configure(
ALLOWED_HOSTS=['*'],
CACHES={'default':
@ -229,7 +236,7 @@ def configure_django():
SESSION_ENGINE='django.contrib.sessions.backends.file',
SESSION_FILE_PATH=sessions_directory,
STATIC_URL='/'.join([cfg.server_dir, 'static/']).replace('//', '/'),
STRONGHOLD_PUBLIC_NAMED_URLS=('users:login', 'users:logout'),
STRONGHOLD_PUBLIC_URLS=public_urls,
TEMPLATES=templates,
USE_L10N=True,
USE_X_FORWARDED_HOST=cfg.use_x_forwarded_host)