add script that runs gunicorn production server

This commit is contained in:
Joeri Exelmans 2025-11-06 10:30:20 +01:00
parent 8359d6e521
commit 95b14ee41b
4 changed files with 68 additions and 1 deletions

24
src/mtl/run_gunicorn.py Normal file
View file

@ -0,0 +1,24 @@
from gunicorn.app.base import BaseApplication
class StandaloneApplication(BaseApplication):
def __init__(self, app, options=None):
self.options = options or {}
self.application = app
super().__init__()
def load_config(self):
for key, value in self.options.items():
self.cfg.set(key.lower(), value)
def load(self):
return self.application
def run_gunicorn():
from .run_server import app
options = {
"bind": "127.0.0.1:15478",
"workers": 12,
}
StandaloneApplication(app, options).run()