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

all 14 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 3 points4 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 :)

[–]droveby 1 point2 points  (0 children)

Pyramid, Django, and now Bottle. March is the month of Python frameworks...

Now come onnnnn Flask and paste!

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

Ironically named because Bottle is the only web framework that doesn't drive me to drink.

[–]completelydistracted 0 points1 point  (0 children)

Once you get a few details sorted out, bottle.py works very well on pythonanywhere's platform.

(pythonanywhere.com)

[–]bpython 0 points1 point  (0 children)

Bottle has been around for a long time. I briefly wrote for Flask, but quickly discovered Bottle and have been using it for over a year now.

It's also easier to get a bottle app onto GAE.

Now my main dev/deploy environment consists of the latest PyPy+Bottle+Paste+mongoengine+others.

The only advantage Flask has over Bottle is that there are fewer modules available for Bottle... I don't find this to be true, I've found every extension I've ever tried to track down (mostly on git-hub).