I am setting up an Eve instance for production and wonder what is the "preferred production setup" for Eve - if there is such a thing. uWSGI seem to work nice. Gunicorn works nice with standard Flask - but not so easily for Eve as Eve has an implicit import of "settings.py". Suggestions or recommandations?
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).
So imagine you have your average run.py
script for launching your REST API:
from eve import Eve
app = Eve()
# custom stuff here
if __name__ == '__main__':
app.run()
You could then have a run-production.py
script like this:
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()
You can then launch run.py
when debugging, and run-production.py
when going live.