feat: Update web page and added install script

This commit is contained in:
2024-02-24 19:30:26 +11:00
parent 0f2afdfa37
commit 631df4d676
7 changed files with 87 additions and 6 deletions

33
server.py Normal file
View File

@@ -0,0 +1,33 @@
from flask import Flask
from server import app
import main
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
if __name__ == '__main__':
workers = 1
threads = 2
workers = int(workers)
threads = int(threads)
options = {
'bind': '0.0.0.0:5000',
'workers': workers,
'threads': threads,
}
gunicorn_app = GunicornApp(app, options)
print('Starting server with ' + str(workers) + ' workers and ' + str(threads) + ' threads', flush=True)
gunicorn_app.run()