Skip to content

Commit

Permalink
Merge branch 'hotfix/0.21.2' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
sloria committed Nov 20, 2014
2 parents e357f09 + 4c20cd8 commit 6089b7a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions website/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import importlib

from modularodm import storage
from werkzeug.contrib.fixers import ProxyFix

import framework
from framework.flask import app, add_handlers
Expand Down Expand Up @@ -109,4 +110,12 @@ def init_app(settings_module='website.settings', set_backends=True, routes=True)

if set_backends:
ensure_schemas()
apply_middlewares(app, settings)
return app

def apply_middlewares(flask_app, settings):
# Use ProxyFix to respect X-Forwarded-Proto header
# https://stackoverflow.com/questions/23347387/x-forwarded-proto-and-flask
if settings.LOAD_BALANCER:
flask_app.wsgi_app = ProxyFix(flask_app.wsgi_app)
return flask_app
2 changes: 2 additions & 0 deletions website/settings/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def parent_dir(path):
STATIC_FOLDER = os.path.join(BASE_PATH, 'static')
STATIC_URL_PATH = "/static"

LOAD_BALANCER = False

LOG_PATH = os.path.join(APP_PATH, 'logs')
TEMPLATES_PATH = os.path.join(BASE_PATH, 'templates')
ANALYTICS_PATH = os.path.join(BASE_PATH, 'analytics')
Expand Down
2 changes: 1 addition & 1 deletion website/static/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
self.filesUrl = result.url+'files/';
self.user = result.user;

$.ajax('/api/v1'+ result.url + '/').success(function(data){
$.ajax('/api/v1'+ result.url).success(function(data){
if (typeof data.profile !== 'undefined') {
self.gravatarUrl(data.profile.gravatar_url);
}
Expand Down

0 comments on commit 6089b7a

Please sign in to comment.