aboutsummaryrefslogtreecommitdiff
path: root/wqflask/runserver.py
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/runserver.py')
-rw-r--r--wqflask/runserver.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/wqflask/runserver.py b/wqflask/runserver.py
index 0342b7ad..7c06356b 100644
--- a/wqflask/runserver.py
+++ b/wqflask/runserver.py
@@ -1,5 +1,7 @@
# Starts the webserver with the ./bin/genenetwork2 command
#
+# This uses Werkzeug WSGI, see ./run_gunicorn.py for the alternative
+#
# Please note, running with host set externally below combined with
# debug mode is a security risk unless you have a firewall setup, e.g.
#
@@ -11,25 +13,25 @@ import logging
import utility.logger
logger = utility.logger.getLogger(__name__ )
+import signal
+signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+
BLUE = '\033[94m'
GREEN = '\033[92m'
BOLD = '\033[1m'
ENDC = '\033[0m'
-import os
-app.config['SECRET_KEY'] = os.urandom(24)
-
-from utility.tools import WEBSERVER_MODE,get_setting_int
+from utility.startup_config import app_config
-port = get_setting_int("SERVER_PORT")
-
-logger.info("GN2 is running. Visit %shttp://localhost:%s/%s" % (BLUE,port,ENDC))
+app_config()
werkzeug_logger = logging.getLogger('werkzeug')
+from utility.tools import WEBSERVER_MODE, SERVER_PORT
+
if WEBSERVER_MODE == 'DEBUG':
app.run(host='0.0.0.0',
- port=port,
+ port=SERVER_PORT,
debug=True,
use_debugger=False,
threaded=False,
@@ -38,7 +40,7 @@ if WEBSERVER_MODE == 'DEBUG':
elif WEBSERVER_MODE == 'DEV':
werkzeug_logger.setLevel(logging.WARNING)
app.run(host='0.0.0.0',
- port=port,
+ port=SERVER_PORT,
debug=False,
use_debugger=False,
threaded=False,
@@ -46,9 +48,9 @@ elif WEBSERVER_MODE == 'DEV':
use_reloader=True)
else: # staging/production modes
app.run(host='0.0.0.0',
- port=port,
+ port=SERVER_PORT,
debug=False,
use_debugger=False,
threaded=True,
- processes=8,
+ processes=0,
use_reloader=True)