3 ms·
Great news! But why is the example for Flask?
by john2x 15y ago
Great news! But why is the example for Flask?
- Nic0 15y agoMaybe because it takes less code to write a "hello world" with Flask than with Django.
- paul-woolcock 15y agoDefinitely this. A database is a requirement for a Django app, but not for Flask. I always seem to go back and forth about whether to start a micro-framework like Flask and use plugins and Python libs to assembly a framework that has only what I need, or use Django and (possible) include a lot of code that will never get run.
- Pewpewarrows 15y agoIt really depends on your vision for the app. If this is a single weekend project or a toy web site that you'll likely never touch again, or if you do will only be for minor updates, then I say go for Flask. It'll get in your way less and let you just launch it sooner. For anything larger than that though, Flask has always turned into a giant headache for me. As soon as I ever start to try and organize the project better because it's become too large for a single file, all shit hits the fan. Supposedly this has gotten slightly better with 0.7's Blueprints, but I've yet to see it. Circular imports and Flask's global variables bite me in the ass on a regular basis. I also have come to really miss tons of features that Django offered, like URLconfs. The decorator technique works great when you can count the number of URLs that your app has on two hands. Beyond that, ack/grepping my project to find where anything lives isn't my idea of maintainable. With Django I can very cleanly trace through the whole request/response cycle in my head and by looking at the code paths.
- fakeempire 15y agoI've been running multi file apps since before 0.7. If you read the documentation or searched mailing lists or looked at example applications you can see how. Blueprints made it even better. 2. In the documentation you will find that you can list out routes just like django. http://flask.pocoo.org/docs/api/#flask.Flask.add_url_rule http://flask.pocoo.org/docs/api/#flask.Flask.add_url_rule
- Pewpewarrows 15y agoI've read through all the documentation, and researched extensively. I still ran into problems way too often to ever warrant using it over a full framework for larger projects.
- fakeempire 15y agoI'm not trying to get you to use Flask or anything. But I definitely find it interesting that you have "read through the documentation or researched extensively" but were unable to find `add_url_rule`. Either way, I'm glad we have selection and choice. At least we both like python! Peace
- kingkilr 15y agoA database is not required fr Django.
- paul-woolcock 15y agoAh, my mistake
- proles 15y agofound that interesting as well, given that the release is around python+django, but it makes sense for the sake of quickly doing a demo with minimal requirements. [edit] does adding Flask in requirements.txt automatically handle the easy_install portion?
- calloc 15y agoanything in the requirements.txt is picked up by pip and installed into a virtualenv from what I have been able to gather.
- craigkerstiens 15y agoFlask is very lightweight and simple to get up and running. We also have a guide within the devcenter to get up and running with Django: http://devcenter.heroku.com/articles/django http://devcenter.heroku.com/articles/django