python bash $ gunicorn myproject.wsgi:application python from gunicorn.app.base import BaseApplication from myproject.wsgi import application class GunicornApp(BaseApplication): def __init__(self, options=None): self.options = options or {} super().__init__() def load_config(self): for key, value in self.options.items(): self.cfg.set(key, value) def load(self): return application if __name__ == '__main__': options = { 'bind': '127.0.0.1:8000', 'workers': 4, 'worker_class': 'sync', 'timeout': 30 } GunicornApp(options).run()


上一篇:
下一篇:
切换中文