Adding gunicorn as a multi-threaded production server
This commit is contained in:
parent
acd14afd4e
commit
8e5a827b75
|
|
@ -102,7 +102,7 @@ form input.form-control {
|
|||
<hr/>
|
||||
{% block viz %}
|
||||
{% if error_msg %}
|
||||
<div class="alert alert-danger">{{ error_msg }}</div>
|
||||
<span class="alert alert-danger">{{ error_msg }}</span>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
#---------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
flask
|
||||
flask-alembic
|
||||
flask-appbuilder
|
||||
gunicorn
|
||||
mysql-python
|
||||
pandas
|
||||
parsedatetime
|
||||
|
|
|
|||
19
run.py
19
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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue