diff --git a/app/templates/panoramix/datasource.html b/app/templates/panoramix/datasource.html
index 410253171..b2f315035 100644
--- a/app/templates/panoramix/datasource.html
+++ b/app/templates/panoramix/datasource.html
@@ -102,7 +102,7 @@ form input.form-control {
{% block viz %}
{% if error_msg %}
- {{ error_msg }}
+ {{ error_msg }}
{% endif %}
{% endblock %}
diff --git a/config.py b/config.py
index ed71108fc..093f5cf4d 100644
--- a/config.py
+++ b/config.py
@@ -13,6 +13,7 @@ There' a ``from local_config import *`` at the end of this file.
# Panoramix specifix config
#---------------------------------------------------------
ROW_LIMIT = 5000
+WEBSERVER_THREADS = 8
PANORAMIX_WEBSERVER_PORT = 8088
#---------------------------------------------------------
diff --git a/requirements.txt b/requirements.txt
index 6819d9960..73d0e8889 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,7 @@
flask
flask-alembic
flask-appbuilder
+gunicorn
mysql-python
pandas
parsedatetime
diff --git a/run.py b/run.py
index 954749f8c..8cc161e38 100644
--- a/run.py
+++ b/run.py
@@ -1,8 +1,19 @@
from app import app
import config
+from subprocess import Popen
+
+if config.DEBUG:
+ app.run(
+ host='0.0.0.0',
+ port=int(config.PANORAMIX_WEBSERVER_PORT),
+ debug=True)
+else:
+ cmd = (
+ "gunicorn "
+ "-w 8 "
+ "-b 0.0.0.0:{config.PANORAMIX_WEBSERVER_PORT} "
+ "app:app").format(**locals())
+ print("Starting server with command: " + cmd)
+ Popen(cmd, shell=True).wait()
-app.run(
- host='0.0.0.0',
- port=int(config.PANORAMIX_WEBSERVER_PORT),
- debug=config.DEBUG)