Use gunicorn as WSGI server in ML image

This commit is contained in:
Olly Welch
2023-02-28 22:06:39 +00:00
parent 6414293ffe
commit b4c35ea578
2 changed files with 15 additions and 2 deletions
+13
View File
@@ -0,0 +1,13 @@
"""
Gunicorn configuration options.
https://docs.gunicorn.org/en/stable/settings.html#config-file
"""
import os
# Set the bind address based on the env
server_port = os.getenv('MACHINE_LEARNING_PORT') or "3003"
bind = f"127.0.0.1:{server_port}"
# Preload the Flask app / models etc. before starting the server
preload_app = True