24 lines
586 B
Python
24 lines
586 B
Python
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()
|