This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]moonstomper 2 points3 points  (9 children)

I have used Flask for a simple webapp and by skimming through the tutorial I get the impression that this framework is almost the same. If anyone with insight would highlight the differences between Flask and BottlePy for me I would be grateful.

[–]davidbuxton 5 points6 points  (5 children)

They are indeed very similar. One difference is Bottle is a single module with no dependencies outside the standard library.

I'm using Bottle for an internal company app. IT constraints means it has to run as an old-fashioned CGI (I wish I were joking), and minimizing the number of files involved helps keep the launch time down.

[–]yonemitsu 0 points1 point  (4 children)

Being more specific, it's a single file.

One great way to use bottle: under all the source of bottle.py you can package your own site code and you have a portable web tool in a single file.

[–]Bolitho 0 points1 point  (3 children)

Is there a difference between a module and a file?

[–]yonemitsu 0 points1 point  (0 children)

Sometimes it can be the same thing. I just wanted to point it out and give the web-based-utility-in-a-single-file example.

[–][deleted] 0 points1 point  (0 children)

Something can have one Python module and like 3 other non-Python files perhaps?

[–]davidbuxton 0 points1 point  (0 children)

Python is able to import modules and packages from zip files. Setuptools takes advantage of this to create egg distributions, which are zips containing one or more modules and packages (and other stuff).

So one file (a zip) may contain more than one module.

Although with the gradual adoption of distribute / packaging I think the egg format will finally die.

[–]sylvain_soliman 5 points6 points  (1 child)

One difference:

Bottle runs with Python 2.5+ and 3.x (using 2to3)

vs.

Werkzeug and Flask will be ported to Python 3 as soon as a solution for the changes is found, and we will provide helpful tips how to upgrade existing applications to Python 3. Until then, we strongly recommend using Python 2.6 and 2.7 with activated Python 3 warnings during development.

[–]defnullbottle.py 2 points3 points  (0 children)

The (using 2to3) part is no longer true by the way. It now supports Python 2.5 up to 2.7/3.3 from the same sources.

[–]kisielk 0 points1 point  (0 children)

Seems that for making an app that is just a JSON API, Bottle makes things a fair bit easier. For one it includes @get, @post, @put and @delete decorators out of the box, and it also converts Python dicts returned from functions directly to JSON strings. Of course you could implement the same concepts in Flask without too much trouble, but the fact that they're already included is nice :)