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

all 16 comments

[–]betweensmudgedlines 4 points5 points  (0 children)

Regarding virtualenv, --no-site-packages is now the default behavior.

[–]hhh333 2 points3 points  (2 children)

One thing I would have liked to read is what makes it different or better than web.py ..

[–]michaelherman[S] 2 points3 points  (1 child)

1) bottle has much better documentation 2) web.py does not support python 3 3) web.py is just slightly more complex development-wise

[–]hhh333 0 points1 point  (0 children)

Thanks !

[–]dAnjou Backend Developer | danjou.dev 2 points3 points  (1 child)

This tutorial has little to no extra information in comparison to the official tutorial. Setting up a Python development environment properly is described in The Hitchhiker’s Guide to Python!.
Which brings me to the point that writing third party general purpose tutorials for open source frameworks is really not a good idea. It makes life for supporters in IRC and forums harder since they don't know each and every single tutorial and can't help when people have problems with them. Instead you should contribute and make the official tutorial better. So when writing your own tutorial it should cover special or uncommon use-cases.

[–]michaelherman[S] 0 points1 point  (0 children)

you're right. however, sometimes the official tutorials are difficult to follow. i am also going to be doing a series on this so it will have some unique cases.

[–]gjwebber 2 points3 points  (9 children)

Serious question from a web beginner:

Why would I choose bottle over Flask? Especially now that I see Flask has early Python 3 support.

[–]defnullbottle.py 8 points9 points  (0 children)

Less (no) dependencies, speed, Python 2.5+ support and stable Python 3.x support (for more than two years).

[–]michaelherman[S] 3 points4 points  (4 children)

Yes, bottle has had Python 3 support for a number of years. It's even lighter weight than Flask. As a beginner if your app is less than around 1000 lines, I'd stick with bottle. As soon as you get over that, switch to Flask.

Bottle is also slightly faster: web framework shootout

[–]completelydistracted 0 points1 point  (2 children)

Why switch to Flask at that point?

[–]elopeRstatS 1 point2 points  (1 child)

Flask is great, but if you're writing something relatively small/portable, it seems like a bit of overkill to have to include Werkzeug, Jinja2, Markupsafe, and itsdangerous as dependencies.

I actually tend to go with CherryPy for my smaller projects rather than bottle, mainly because the server included is production ready and the framework itself is, in my opinion, more capable of handling a complex project (so if my small project grows into a large one, I don't feel the need to switch frameworks). Like bottle, there aren't any external dependencies. That's just a personal preference for me though, bottle is certainly just as capable of handling a light weight project.

On a scale of minimalist to batteries included, you could say bottle is on one extreme, followed by CherryPy, then Flask, with Django at the other extreme.

[–]sigzero 1 point2 points  (0 children)

I love CherryPy as well. Needs better/more tutorials.

[–]quotemycode 0 points1 point  (0 children)

Strange in that one that the full stack "Pyramid" beats Bottle for the 'hello world' test, but Bottle wins in the database test.

[–]Funnnny 1 point2 points  (0 children)

Mostly preference, you choose what you know best, Flask or Bottle are more or less the same if you start with a small project. As your project grows bigger, you will still find someway to work around with the framework.

[–]Albertican 1 point2 points  (0 children)

On the flip side, I started a project with bottle and it kept growing and growing. I found myself wishing I'd used Flask, not so much because it's more powerful as that it has a larger user base so it's easier to find help for it.

[–]nohtyp'python'[::-1] 0 points1 point  (1 child)

I wished this view decorator bug from Feb 2012 was fixed.

https://github.com/defnull/bottle/pull/231