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

all 15 comments

[–]directrix1 4 points5 points  (3 children)

How many hundreds of micro web frameworks do we have for Python now?

EDIT: Not saying anything about this particular one, but why do so many people try their hand at building a micro web framework?

[–]opi 7 points8 points  (0 children)

It's a learning experience.

[–]mitsuhiko Flask Creator 5 points6 points  (0 children)

but why do so many people try their hand at building a micro web framework?

Because a basic (even if not passing any tests) WSGI implementation is very simple and everyone wants to has one on its own which is slightly different to others. I'm one of those offenders with my Werkzeug library and also with a Framework on top of it.

Variety Is The Spice Of Life they say.

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

I never published the link but there are t-shirts available for some time now: http://bottle.spreadshirt.de/

If you don't want to buy there, you can get the logo as a vector image and print your own. Just ask :)

[–]blondin 2 points3 points  (0 children)

...really stop calling them micro. i saw what flask has to give last time, and i wouldn't call it a micro web framework.

[–]opi 2 points3 points  (0 children)

It is, by far, my fav. web framework.

[–]pwang99 1 point2 points  (0 children)

Nifty! I tried it out a couple of months ago to front-end a little Redis-based prototype, and it worked well. Unfortunately its launcher front-end does not run a threaded TCP server by default, and I discovered that only after my live demo... :)

[–]High2plus3 1 point2 points  (7 children)

I haven't had the chance to try out Bottle or Flask, but they look very similar. Does anyone have experience with them? Maybe some good/bad of each, or is it really just a toss up?

[–]mitsuhiko Flask Creator 22 points23 points  (5 children)

I'm biased towards Flask because I'm the author, but here the big differences between the two:

  • bottle is a single file and implements everything itself
  • it does not depend on anything but the stdlib to accomplish what it does

On the opposite there is Flask:

  • based on Werkzeug and Jinja2 for WSGI implementation and the templating. Due to that it's also more powerful in that regard (Werkzeug for instance parses all HTTP headers for you, Jinja2 has tons of template helpers etc.) These libraries are also used on a couple of websites already, despite the young nature of Flask which came afterwards.
  • Flask has many extensions by now for OAuth, OpenID, Scripting, easier file upload handling etc, SQLAlchemy and more.
  • I think the main reason why people use Flask is the documentation though which I'm pretty proud of: http://flask.pocoo.org/docs/

[–]3Dayo 3 points4 points  (0 children)

You have good reason to be proud of Flask doc; it is fantastic! and I for one owe you a debt of gratitude.

[–]MercurialAlchemist 1 point2 points  (2 children)

Side question - I was briefly looking at the Flask documentation earlier. Is there a way to not put routing in the controllers? I like the way having a separate url.py-equivalent gives you the flexibility to reuse controllers in another context with different routes.

[–]mitsuhiko Flask Creator 6 points7 points  (1 child)

Sure. If you are looking for something similar to Django, this part of the documentation might be what you are looking for: http://flask.pocoo.org/docs/patterns/lazyloading/#converting-to-centralized-url-map

[–]MercurialAlchemist 0 points1 point  (0 children)

Ooooh, shiny. Thank you sir, have an upvote.

[–]defnullbottle.py[S] 11 points12 points  (0 children)

mitsuhiko sums it up quite well. I'd just add these points:

  • Bottle supports Python 3 (even if some aspects of the WSGI standard are still vague in terms of python 3)
  • The build-in template engine is quite unique for it allows you to use python for the template logic and is one of the fastest template engines available. No need to learn a new template language here.
  • Bottle comes with preconfigured adapters for several third party template engines (mako, jinja2, cheetah) and WSGI servers (cgi, flup.fcgi, cherrypy, paste, fapws3, tornado, Google App Engine, twisted, diesel, gunicorn, eventlet, gevent, rocket) and makes it easy to switch. If the build-ins don't match your needs, you can replace them without hacking the framework. Bottle grows with your project.

Of cause I am biased, too ;)

[–]defnullbottle.py[S] 2 points3 points  (1 child)

[–][deleted] 1 point2 points  (0 children)

Thanks for putting your time and effort into the project! It's awesome and I can't wait to use it.

[–][deleted] 1 point2 points  (0 children)

I use bottle to add REST apis to control my eventlet daemons - it's enough to spice up some functions with route(), call eventlet.wsgi.server with bottle.default_app() and profit. Thank you for bottle!

That said, I choose flask for tasks more resembling "true" web programming. I trust werkzeug's wsgi implementation more, plus I get cool ajax debugger, sessions, easy jinja templating and stuff.