Live data from Hacker News

Flask 0.7 Released (Python Web Framework)

flask.pocoo.org

61–70 of 80 posts

Re: Flask 0.7 Released (Python Web Framework)

#61
Flask is awesome and can be easily supercharged by pairing it with Paste Deploy: http://pythonpaste.org/deploy

This way you get Flask simplicity and elegance, but also you get Rails-like separation of configuration test/development/production environments.

Another misconception people seem to have is that Flask means Jinja2. Fortunately that's not the case, swapping Jinja with Mako is also extremely easy.

Finally, Flask can run on top of any WSGI server, not just a built-in one: at http://mailgun.net we have Flask services running on Tornado and on Paster servers - the thing is rock solid.

Re: Flask 0.7 Released (Python Web Framework)

#62

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…

Check out Pantyshot/Upskirt for Markdown, it's worked out pretty well for me.

Re: Flask 0.7 Released (Python Web Framework)

#63
post #46

Earlier quoted context omitted.

Couldn't you use inspectdb to introspect your Flask database and use Django's admin that way? You'd have to remember to do it every time you changed your database; but it'd probably get you most of the way there.

>You'd have to remember to do it every time you changed your database; That's probably why he just finds it easier to use django.

I don't disagree with that sentiment for use during development; but for a long-lived application I don't think it's nearly as big a deal.

I don't know about you, but I've personally found that after a few months of working on an application the models tend to be pretty stable.

Re: Flask 0.7 Released (Python Web Framework)

#64

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…

To learn Ruby I decided to redo my website in it, and I felt the complete opposite. I was surprised there's nothing comparable in the Ruby world to Jinja2 or Mako. Nothing supports blocks/macros or template inheritance, so I wrote my own small template engine in Ruby that does.

Re: Flask 0.7 Released (Python Web Framework)

#65
post #53

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?

You can roll out your own or use one of the existing translators which translate from haml to jinja2 syntax. Do you use slim templates? I recently wrote a hand rolled recursive decent parser which translates slim to jinja2 - https://github.com/thoughtnirvana/slimish-jinja2 . Jinja2 supports extensions and after adding this extension, you can write slim templates which will be translated to jinja2 on the run. The lexe…

Interesting. Seems I haven't grasped the flexibility of jinja. I'll look into this, thanks.

Re: Flask 0.7 Released (Python Web Framework)

#66

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's a Nemo[1] a "pythonic haml". It doesn't follow the Haml spec exactly, but rather tries to take the good parts and apply them to something suitable for Pythonistas. It's built over Mako templates, so its faster and far more flexible than one built against the Django template markup. [1] https://github.com/9cloud/Nemo

This is much better than what I found last time I went looking, thanks. I think I need to roll up my sleeves and dig deeper... Being able to mutate the templates to suit what I usually might build seems cool (but a big time sink!).

Re: Flask 0.7 Released (Python Web Framework)

#67
post #41
post #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 t…

Tornado is batteries included. Flask uses Werkzeug and Jinja2 and encourages packaging extensions for localization, form processing, ORM's etc.. Flask, Werkzeug and Jinja2 are all Pocoo projects that have a good community around them and excellent documentation. Technically I would not like to argue the superiority of either, although Flask seems to fit my tastes much better. Flask's use and deployment of "magic" is…

Why would it be good to avoid passing around the request object?

Re: Flask 0.7 Released (Python Web Framework)

#68

Flask is awesome and can be easily supercharged by pairing it with Paste Deploy: http://pythonpaste.org/deploy This way you get Flask simplicity and elegance, but also you get Rails-like separation of configuration test/development/production environments. Another misconception people seem to have is that Flask means Jinja2. Fortunately that's not the case, swapping Jinja with Mako is also extremely easy. Finally, Fl…

I notice that several projects (including Flask) do not build in support for DB schema management- e.g. migrations.

For those of you who are writing apps in Flask, how do you guys manage changes in DB schema ?

Re: Flask 0.7 Released (Python Web Framework)

#69

Flask is awesome and can be easily supercharged by pairing it with Paste Deploy: http://pythonpaste.org/deploy This way you get Flask simplicity and elegance, but also you get Rails-like separation of configuration test/development/production environments. Another misconception people seem to have is that Flask means Jinja2. Fortunately that's not the case, swapping Jinja with Mako is also extremely easy. Finally, Fl…

I notice that several projects (including Flask) do not build in support for DB schema management- e.g. migrations. For those of you who are writing apps in Flask, how do you guys manage changes in DB schema ?

Flask doesn't have any sort of database interaction built in. You do it all with the more general Python tools. SQLAlchemy is a common ORM for Flask, probably because of the Flask-SQLAlchemy extension. I've never done any migrations with Flask, but I would think http://code.google.com/p/sqlalchemy-migrate/ could do it.

Re: Flask 0.7 Released (Python Web Framework)

#70

Flask is awesome and can be easily supercharged by pairing it with Paste Deploy: http://pythonpaste.org/deploy This way you get Flask simplicity and elegance, but also you get Rails-like separation of configuration test/development/production environments. Another misconception people seem to have is that Flask means Jinja2. Fortunately that's not the case, swapping Jinja with Mako is also extremely easy. Finally, Fl…

I notice that several projects (including Flask) do not build in support for DB schema management- e.g. migrations. For those of you who are writing apps in Flask, how do you guys manage changes in DB schema ?

Flask has become my framework of choice because it's incredibly well designed, the code is clean, and also because it's decoupled from an ORM.

Rails and Django emerged at a time when RDBMS ruled, and they were both built around an ORM. Now you have more database options that have less of an impedance mismatch, but because Rails and Django are so ORM-centric, forgoing the RDBMS in favor of another option means you now have a framework mismatch.

Graphs are a much more elegant way of storing relational data. With graph databases you don't have to mess with tables or joins -- everything is explicitly joined.

For most Web development projects, I have shifted from a relational database to a graph database as the primary datastore, and use Redis, Memcached, and MongoDB for specialized purposes when called for.

Neo4j Community Edition (http://neo4j.org/) is open source and now free, and pairing it with the TinkerPop stack (http://www.tinkerpop.com/) is ideal.

With Neo4j you can now store 32 billion nodes (http://blog.neo4j.org/2011/03/neo4j-13-abisko-lampa-m04-size...) with 2 million traversals per second (http://www.infoq.com/news/2010/02/neo4j-10), and you can use Gremlin with it (the graph traversal language), which let's you calculate PageRank in 2 lines -- to see what you can do with Gremlin, check out this 10 min screencast (http://www.youtube.com/watch?v=5wpTtEBK4-E).

For tabular data, relational databases rock. But the relational model doesn't align well with object-orientated programming so you have an ORM layer that adds complexity to your code. And with relational databases, the complexity of your schema grows with the complexity of the data.

The graph-database model simplifies much of this and makes working with the modern-day social graph so much cleaner. Graphs allow you to do powerful things like find inferences inside the data in ways that would be hard to do with relational databases.

There is an open-source Python persistence framework in the works called Bulbs that connects to Neo4j through the Rexster REST server, and there are binary bindings in the works as well. There is also a Python open-source Web development framework for graph databases called Bulbflow that is built on Bulbs and Flask, which will provide stuff like authentication and authorization, in a graph-DB way. Both frameworks should be released in the next few weeks.

Post reply on HN