Closed noamtamim closed 1 week ago
I use bottle in production for 4 years now and it's quite stable.
You can use gunicorn or uWSGI with for multithread/ multiprocess server setups. If non blocking IO is forced by application scope (i.e many external services, concurrent DB IO) you can always use Gevent which plays well with bottle. (Use a variant of GeventServer that will be fine with any version of bottle)
Gevent solves the following issue: While your web framework supports event loops, your popular Database tools don't. Async (at least for now) has no mature libraries that you will need in real life web development. For instance asyncpg is really cool but is too low level compared to SqlAlchemy. On the other hand, wit gevent you can use most of your libraries, thus it provides a more end-to-end solution.
I want 0.13 for stable too, but until then 0.12 must do the job.
I am using 0.13 for more than 2 years in production. No serious problems encoutered. It's rock solid, and if there are problems they are usually my fault!
We are working on 0.13, but the release is tricky as it drops a range of legacy python versions and adds a ton of changes. We usually try to provide backwards compatibility from x.y.latest
to x.y+1
and that is really hard to guarantee this time. I would not hold my breath.
1) Bottle is a WSGI framework. It works with any WSGI server out there and you can simply follow the documentation of the server of your choice. The server adapters are completely optional. 2) @PyB1l described it nicely. Most modern WSGI servers are asyncronous under the hood (async network IO), but still call the WSGI callable in a thread pool. If you really need hundreds or thousands of long-running connections (e.g. for websockets), gevent is a good choice. Or ditch WSGI and switch to a pure async framework. There are plenty nowadays. 3) The master branch is usable, even in production, as long as you watch it and stay involved. It is not stable, though. Updates may break things. However, there is no real reason to upgrade if you do not need a new feature or are affected by a bug. Security issues are extremely rare.
Thank you all for the insightful responses. Questions to @defnull:
1) We can call it "Henry" and paint it blue, makes no difference. I like the zero-based version as it reduces the expectations and encourages users to look into the code when they have a problem. It keeps away the "Why does this not work as I expected? Bottle sucks, flask rules!" users. Not sure if there will ever be a 1.0
:) That said, I'm thinking about skipping 0.13 and release 0.14 next, to make it clear that this release may have breaking changes. If you are on Python 2, you are stuck with 0.12 anyway.
2) WSGI is a protocol (defined in PEP-3333) the HTTP server uses to speak with an application. It was designed way before asyncio was a thing. There are other protocols (ASGI) or frameworks that bring their own HTTP server implementation (twisted) that better support fully asynchronous applications. If you really need that (most don't), look into those.
3) Depends on your workload. For production I'd go for nginx and uWSGI, or put a couple of waitress/cheroot instances behind an nginx load-balancer.
A lot happened in the last couple of days. In short: Bottle 0.13 just released, 0.14 may end up becoming 1.0 but that is still undecided. The other questions in this issue were answered I think, so I'm closing this. Thanks all :)
I love Bottle, and I want to use it with a production-grade server. However:
What do you suggest?