You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.0 KiB
Python

# run.py
from gunicorn.app.base import BaseApplication
from main import app # Import your Flask app instance
class FlaskApplication(BaseApplication):
def __init__(self, app, options=None):
self.options = options or {}
self.application = app
super().__init__()
def load_config(self):
config = {key: value for key, value in self.options.items() if key in self.cfg.settings and value is not None}
for key, value in config.items():
self.cfg.set(key.lower(), value)
def load(self):
return self.application
if __name__ == '__main__':
options = {
'bind': '0.0.0.0:8000', # Bind to 0.0.0.0:8000
'workers': 5, # Number of Gunicorn worker processes
'threads': 4, # Number of threads per worker process
'worker_class': 'sync', # Use sync worker class for simplicity
'accesslog': '-', # Log to stdout
'errorlog': '-', # Log to stdout
}
FlaskApplication(app, options).run()