eve 的首选生产设置是什么

What is the preferred production setup for eve

我正在为生产设置一个 Eve 实例,想知道 Eve 的 "preferred production setup" 是什么 - 如果有这样的东西。 uWSGI 似乎工作得很好。 Gunicorn 与标准 Flask 配合得很好——但对于 Eve 来说就没那么容易了,因为 Eve 隐式导入了 "settings.py"。 建议或建议?

Tornado is pretty popular with Eve and Flask in general. Because it is non-blocking and uses epoll, it can handle thousands of simultaneous standing connections, which means it is ideal for real-time web services. Integrating this service with Flask is straightforward (source).

所以假设您有用于启动 REST 的平均 run.py 脚本 API:

from eve import Eve
app = Eve()

# custom stuff here

if __name__ == '__main__':
    app.run() 

然后你可以有一个像这样的 run-production.py 脚本:

from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop

from run import app

http_server = HTTPServer(WSGIContainer(app))
http_server.listen(5000)
IOLoop.instance().start()

然后您可以在调试时启动 run.py,在上线时启动 run-production.py