fix: Don't import gunicorn unless specified by args
All checks were successful
Build Docker / Build Image (push) Successful in 45s
All checks were successful
Build Docker / Build Image (push) Successful in 45s
This commit is contained in:
parent
4652af3a2d
commit
a568abeb49
4
.gitignore
vendored
4
.gitignore
vendored
@ -13,4 +13,6 @@ plugins/signatures.json
|
|||||||
|
|
||||||
user_data/
|
user_data/
|
||||||
customPlugins/
|
customPlugins/
|
||||||
cache/
|
cache/
|
||||||
|
build/
|
||||||
|
dist/
|
||||||
|
31
server.py
31
server.py
@ -3,26 +3,25 @@ import sys
|
|||||||
import platform
|
import platform
|
||||||
from main import app
|
from main import app
|
||||||
from waitress import serve
|
from waitress import serve
|
||||||
from gunicorn.app.base import BaseApplication
|
|
||||||
|
|
||||||
threads = 4
|
threads = 4
|
||||||
|
|
||||||
class GunicornApp(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():
|
|
||||||
if key in self.cfg.settings and value is not None:
|
|
||||||
self.cfg.set(key.lower(), value)
|
|
||||||
|
|
||||||
def load(self):
|
|
||||||
return self.application
|
|
||||||
|
|
||||||
|
|
||||||
def gunicornServer():
|
def gunicornServer():
|
||||||
|
from gunicorn.app.base import BaseApplication
|
||||||
|
class GunicornApp(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():
|
||||||
|
if key in self.cfg.settings and value is not None:
|
||||||
|
self.cfg.set(key.lower(), value)
|
||||||
|
|
||||||
|
def load(self):
|
||||||
|
return self.application
|
||||||
options = {
|
options = {
|
||||||
'bind': '0.0.0.0:5000',
|
'bind': '0.0.0.0:5000',
|
||||||
'workers': 2,
|
'workers': 2,
|
||||||
|
Loading…
Reference in New Issue
Block a user