Skip to content
Snippets Groups Projects
Commit 34fc9771 authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB
Browse files

fixing a few more small bugs for Gunicorn

parent 2e70518f
No related branches found
No related tags found
No related merge requests found
*.swp
*~
*.pyc
apps/static/admin/
apps/static/rest_framework/
apps/static/debug_toolbar/
apps/static/django_extensions/
apps/static/guardian/
config/settings/secret.py
config/settings/local.py
docs/user_docs/build/*
docs/admin_docs/build/*
gracedb/static/admin/
gracedb/static/rest_framework/
gracedb/static/debug_toolbar/
gracedb/static/django_extensions/
gracedb/static/guardian/
......@@ -33,6 +33,10 @@ TEST_RUNNER = 'django.test.runner.DiscoverRunner'
# BrokenLinkEmailsMiddleware is enabled
MANAGERS = ADMINS
# Use forwarded host header for Apache -> Gunicorn reverse proxy configuration
USE_X_FORWARDED_HOST = True
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# Base URL for TwiML bins (for Twilio phone/text alerts)
TWIML_BASE_URL = 'https://handler.twilio.com/twiml/'
......@@ -291,7 +295,7 @@ REST_FRAMEWORK = {
}
# Location of static components, CSS, JS, etc.
STATIC_ROOT = join(CONFIG_ROOT, "static/")
STATIC_ROOT = join(PROJECT_ROOT, "static/")
STATIC_URL = "/gracedb-static/"
STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.FileSystemFinder',
......@@ -301,7 +305,7 @@ STATICFILES_FINDERS = [
STATICFILES_DIRS = []
# Location of Bower packages.
BOWER_URL = "bower-static"
BOWER_URL = "/bower-static/"
BOWER_ROOT = join(GRACEDB_PATHS["home"], "bower_components/")
# Added in order to perform data migrations on the auth and guardian apps
......
......@@ -29,7 +29,7 @@ INSTALLED_APPS += [
# if debug_toolbar is enabled and DEBUG is True.
if DEBUG and debug_middleware in MIDDLEWARE:
MIDDLEWARE.insert(MIDDLEWARE.index(debug_middleware),
'middleware.proxy.XForwardedForMiddleware')
'core.middleware.proxy.XForwardedForMiddleware')
# Tuple of IPs which are marked as internal, useful for debugging.
# Tanner (5 Dec. 2017): DON'T CHANGE THIS! Django Debug Toolbar exposes
......
......@@ -33,14 +33,28 @@ TEST_NAMES = {
}
def extra_args(user):
"""Utility for passing user details to request"""
"""
Utility for passing user details to request. Needed because the web server
does some of the authentication work with Shibboleth
"""
if not user:
return {}
return {
# Information needed from webserver
AUTH_DICT = {
'REMOTE_USER': user.username,
'isMemberOf': ';'.join([g.name for g in user.groups.all()])
'isMemberOf': ';'.join([g.name for g in user.groups.all()]),
}
# Need to handle reverse proxy case where headers are used
# instead of Apache environment variables.
if settings.USE_X_FORWARDED_HOST:
for k in AUTH_DICT.keys():
AUTH_DICT['HTTP_' + k.upper()] = AUTH_DICT.pop(k)
return AUTH_DICT
def request_event_creation(client, user, test=False):
"""
Given a Django test client, attempt to create a CBC, gstlal,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment