Skip to content

Instantly share code, notes, and snippets.

@pferreir
Created August 20, 2014 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pferreir/61ad07e8f6127d326e6f to your computer and use it in GitHub Desktop.
Save pferreir/61ad07e8f6127d326e6f to your computer and use it in GitHub Desktop.
diff --git a/indico/web/flask/app.py b/indico/web/flask/app.py
index a3fbb0e..0f3e3a9 100644
--- a/indico/web/flask/app.py
+++ b/indico/web/flask/app.py
@@ -21,6 +21,7 @@ from __future__ import absolute_import
import os
import re
+import traceback
from flask import send_from_directory, request, _app_ctx_stack
from flask import current_app as app
@@ -229,8 +230,10 @@ def make_app(set_path=False, db_setup=True):
# reason to access it outside this method without being inside an application context.
# When set_path is enabled, SERVER_NAME and APPLICATION_ROOT are set according to BaseURL
# so URLs can be generated without an app context, e.g. in the indico shell
+
if _app_ctx_stack.top:
- Logger.get('flask').warn('make_app({}) called within app context, using existing app'.format(set_path))
+ Logger.get('flask').warn('make_app({}) called within app context, using existing app:\n{}'.format(set_path,
+ '\n'.join(traceback.format_stack())))
return _app_ctx_stack.top.app
app = IndicoFlask('indico', static_folder=None, template_folder='web/templates')
fix_root_path(app)
@@ -248,8 +251,6 @@ def make_app(set_path=False, db_setup=True):
add_compat_blueprints(app)
add_plugin_blueprints(app)
- with app.app_context():
- # re-establish loggers
- Logger.reset()
+ Logger.post_app_creation(app)
return app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment