Live data from Hacker News

Flask 0.7 Released (Python Web Framework)

flask.pocoo.org

31–40 of 80 posts

Re: Flask 0.7 Released (Python Web Framework)

#31
post #17

Earlier quoted context omitted.

An 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.

> 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#L161...

I must have been mistaken for static files, for templates however it is the case:

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`.

Re: Flask 0.7 Released (Python Web Framework)

#32
post #19

Earlier quoted context omitted.

Then again, I also dislike some of the magic in Flask.

For what reason?

Magic 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.

Re: Flask 0.7 Released (Python Web Framework)

#33
post #8

[deleted]

http://flask.pocoo.org/docs/foreword/#the-status-of-python-3

This should not be downvoted and in fact probably needs to be a top-level comment to counter the kind of misinformation the grandparent of this post is basing his complaint on.

Re: Flask 0.7 Released (Python Web Framework)

#34

I'm always impressed by Flask - especially its documentation. In fact, this seems like a good occasion to have a poke around and build something with it. On a slightly related note - although jinja2 is already quite compact, I'm a fan of haml and I'm always surprised by the lack of support for it in Python. Is there something I'm missing? Uncanny valley for Pythonistas?

There was a Haml-like language called GHRML a while back, but it seems to have disappeared. There is something like it called SHPAML: http://shpaml.webfactional.com/

Though I think Ruby has better markup libraries in general. For example, they have Nokogiri, which is an absolute joy to use for XML parsing. And implementations of Markdown and Textile with actual parsers, whereas Python Markdown and Python Textile are straight regex-using ports of the Perl/PHP versions. It's kinda sad really.

Re: Flask 0.7 Released (Python Web Framework)

#35
post #10

Earlier quoted context omitted.

Flask 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.

Then again, I also dislike some of the magic in Flask.

We'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.

Re: Flask 0.7 Released (Python Web Framework)

#36
post #7

Of particular interest are the generic or 'pluggable' class-based views. They work in a very similar manner to the ones that came with Django 1.3. http://flask.pocoo.org/docs/views/ It's good timing; I was just getting to the stage in my app where I was noticing the need for some view refactoring.

Same for me. Class-based views were basically the only thing I missed from django for my particular app.

Re: Flask 0.7 Released (Python Web Framework)

#38
post #31

Earlier quoted context omitted.

> 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#L161...

I must have been mistaken for static files, for templates however it is the case: 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`.

In 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).

Re: Flask 0.7 Released (Python Web Framework)

#39
Right now, I'm writing most of my projects in Tornado.. Not because I need the async, but because I wanted a simple web.py like format that was under active development.

Can someone help me understand where Flask fits into things? It would essentially be a replacement for Tornado? What's the advantage of this over Tornado? Ease of use?

I can understand the simplicity argument; I chose to avoid Django because it was too heavy, so I'd love to hear more about how Flask compares.

Post reply on HN