From bf873dbaea7537a65c2a11531bf9f59d6eb3c7f7 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Tue, 20 Mar 2018 14:39:55 +0100 Subject: [PATCH] Do not set app.config['SERVER_NAME'] if app_context exists. --- module_build_service/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module_build_service/models.py b/module_build_service/models.py index ff16dbda..294cb19b 100644 --- a/module_build_service/models.py +++ b/module_build_service/models.py @@ -132,7 +132,8 @@ def make_session(conf): return # Needs to be set to create app_context. - if 'SERVER_NAME' not in app.config or not app.config['SERVER_NAME']: + if (not has_app_context() and + ('SERVER_NAME' not in app.config or not app.config['SERVER_NAME'])): app.config['SERVER_NAME'] = 'localhost' # If there is no app_context, we have to create one before creating