diff --git a/module_build_service/manage.py b/module_build_service/manage.py
index 2c94f87..866dbde 100644
--- a/module_build_service/manage.py
+++ b/module_build_service/manage.py
@@ -125,7 +125,7 @@ def cleardb():
def build_module_locally(url, branch, skiptests=False):
""" Performs local module build using Mock
"""
- if 'SERVER_NAME' not in app.config:
+ if 'SERVER_NAME' not in app.config or not app.config['SERVER_NAME']:
app.config["SERVER_NAME"] = 'localhost'
with app.app_context():
diff --git a/module_build_service/models.py b/module_build_service/models.py
index 6786968..01f0c37 100644
--- a/module_build_service/models.py
+++ b/module_build_service/models.py
@@ -81,7 +81,7 @@ def make_session(conf):
Yields new SQLAlchemy database sesssion.
"""
# Needs to be set to create app_context.
- if 'SERVER_NAME' not in app.config:
+ if '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