Merge "Fix werkzeug imports for version 0.15.x"
This commit is contained in:
commit
f185d6630e
@ -20,7 +20,13 @@ import oslo_i18n
|
|||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from oslo_middleware import healthcheck
|
from oslo_middleware import healthcheck
|
||||||
import six
|
import six
|
||||||
import werkzeug.wsgi
|
|
||||||
|
try:
|
||||||
|
# werkzeug 0.15.x
|
||||||
|
from werkzeug.middleware import dispatcher as wsgi_dispatcher
|
||||||
|
except ImportError:
|
||||||
|
# werkzeug 0.14.x
|
||||||
|
import werkzeug.wsgi as wsgi_dispatcher
|
||||||
|
|
||||||
import keystone.api
|
import keystone.api
|
||||||
from keystone import exception
|
from keystone import exception
|
||||||
@ -167,7 +173,7 @@ def application_factory(name='public'):
|
|||||||
# Use the simple form of the dispatch middleware, no extra logic needed
|
# Use the simple form of the dispatch middleware, no extra logic needed
|
||||||
# for legacy dispatching. This is to mount /healthcheck at a consistent
|
# for legacy dispatching. This is to mount /healthcheck at a consistent
|
||||||
# place
|
# place
|
||||||
app.wsgi_app = werkzeug.wsgi.DispatcherMiddleware(
|
app.wsgi_app = wsgi_dispatcher.DispatcherMiddleware(
|
||||||
app.wsgi_app,
|
app.wsgi_app,
|
||||||
{'/healthcheck': hc_app})
|
{'/healthcheck': hc_app})
|
||||||
return app
|
return app
|
||||||
|
@ -15,7 +15,13 @@ import os
|
|||||||
|
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
import stevedore
|
import stevedore
|
||||||
from werkzeug.contrib import fixers
|
|
||||||
|
try:
|
||||||
|
# werkzeug 0.15.x
|
||||||
|
from werkzeug.middleware import proxy_fix
|
||||||
|
except ImportError:
|
||||||
|
# werkzeug 0.14.x
|
||||||
|
from werkzeug.contrib import fixers as proxy_fix
|
||||||
|
|
||||||
from keystone.common import profiler
|
from keystone.common import profiler
|
||||||
import keystone.conf
|
import keystone.conf
|
||||||
@ -126,8 +132,8 @@ def setup_app_middleware(app):
|
|||||||
factory_func = loaded.driver.factory({}, **mw.conf)
|
factory_func = loaded.driver.factory({}, **mw.conf)
|
||||||
app.wsgi_app = factory_func(app.wsgi_app)
|
app.wsgi_app = factory_func(app.wsgi_app)
|
||||||
|
|
||||||
# Apply werkzeug speficic middleware
|
# Apply werkzeug specific middleware
|
||||||
app.wsgi_app = fixers.ProxyFix(app.wsgi_app)
|
app.wsgi_app = proxy_fix.ProxyFix(app.wsgi_app)
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user