WSGI: Move the application creation within the app method

Otherwise the application is likely ever loaded once instead of being
put back into the context every time.

Change-Id: I686bea29bc4f6e2450dcc47e94640ace6f73dcc6
This commit is contained in:
David Moreau Simard 2018-05-11 10:39:47 -04:00
parent 513382dd77
commit c6b2984141
1 changed files with 1 additions and 1 deletions

View File

@ -50,7 +50,6 @@ from ara.webapp import create_app # flake8: noqa
from flask import current_app # flake8: noqa
log = logging.getLogger(__name__)
app = create_app()
def application(environ, start_response):
@ -60,6 +59,7 @@ def application(environ, start_response):
if 'ANSIBLE_CONFIG' not in os.environ:
log.warn('ANSIBLE_CONFIG environment variable not found.')
app = create_app()
if not current_app:
ctx = app.app_context()
ctx.push()