4 ms·
How does Flask compare to Bottle (http://bottlepy.org/docs/dev/index.html http://bottlepy.org/docs/dev/index.html)? Any advantages/disadvantages?
by louis14 15y ago
How does Flask compare to Bottle (http://bottlepy.org/docs/dev/index.html http://bottlepy.org/docs/dev/index.html)? Any advantages/disadvantages?
- DasIch 15y agoFlask has more features, more and better documentation, a bigger community and ecosystem as well as more developers behind it. Furthermore Bottle does magic that is frowned upon by some people.
- jsherer 15y ago"does magic that is frowned upon by some people." Can you elaborate?
- the_mitsuhiko 15y agoI would describe it more carefully. Bottle's advantage that it's self contained and in a single file, however bottle's design also hides away the application object from you which makes it quite hard to have more than one of them. It is possible with the stacked object thing and I think they changed it even to make it possible to do what Flask did, but when Flask started at least there was a design difference there. By now I really would like to see them merge, but Bottle wants to stick to the design idea of just having one file which Flask will never be able to do because of the dependencies.
- louis14 15y agoAny reasons why they should merge if they are so different?
- alvivar 15y agoMerge is an excellent idea when two projects, frameworks, etc have the same goals (Not necessarily the same features). For example The Pylons Project taking BFG as is base and making Pyramid, with all the experience from Pylons community and BFG. This will make changes on both sides of the community but brings a new Framework with the possibility of improvement. I guess the idea is take the best from both frameworks y make a new one, better, with a big community, and a lot of knowledge from the previous experiences.
- sigzero 15y agoConsolidation of resources and talents. That is all I can think of.
- DasIch 15y agoAn example would be that Bottle creates an application object implicitly and assumes that all resources(templates, static files, etc.) are relative to the cwd. However the WSGI specification doesn't define what the cwd points to so you have to work around that for some servers. If you use Flask you create the application object explicitly and pass it the name of the module, relative to which Flask looks up resources.
- oinksoft 15y ago> assumes that all resources(templates, static files, etc.) Reading the source, I see no evidence of this. https://github.com/defnull/bottle/blob/master/bottle.py#L1614 https://github.com/defnull/bottle/blob/master/bottle.py#L161...
- DasIch 15y agoI must have been mistaken for static files, for templates however it is the case: https://github.com/defnull/bottle/blob/master/bottle.py#L2635 https://github.com/defnull/bottle/blob/master/bottle.py#L263... You can override it but you would have to do that for every call to `template` or by monkey patching `TEMPLATE_PATH`.
- oinksoft 15y agoIn the big picture, I don't see having to write a wrapper function for template rendering with a fixed template_lookup argument being a big deal (I'm basing all of my judgments on source alone, I've only fiddled with either framework).
- DasIch 15y agoIt's still a problem for modularity, something like Flask's blueprints are basically impossible for Bottle.
- dochtman 15y agoThen again, I also dislike some of the magic in Flask.
- louis14 15y agoFor what reason?
- dochtman 15y agoBecause I just dislike magic.
- hackoder 15y agoMagic can come to haunt you when you get stuck. For e.g. flask has thread locals where the request variable gets populated with the current request's context dynamically. For the most part though, Flask is very magic free and the source is small enough to quickly figure out whats going on.
- the_mitsuhiko 15y agoWe're getting rid of all the magic we can avoid. With 0.7 barely any magic is left with the notable exception of backwards compatibility.
- oinksoft 15y agoBottle is pretty much standalone. Flask requires Jinja2 just to function, for instance. Bottle runs on Python 2.5+ and on Python 3.x.
- deleted 15y ago[deleted]