Re:Ask HN: Why should I use Django?
by odonnellryan on Wednesday November 23, 2016 @10:04PM
(#13027691)
My test for using Django is similar to yours: If I think the project will best be represented with more than one "app" then I will use Django. If not, I'll use Flask.
App can be an API + another part of the site, for example.
Re:Ask HN: Why should I use Django?
by someotheridiot on Thursday November 24, 2016 @06:43PM
(#13033503)
Agreed. I've been using Django for only a little while, and sometimes find it quite frustrating. Then something finally makes sense and I realise I've been doing it wrong and the proper way makes everything soooo easy. The trick is to know when you're doing it the wrong way which isn't always apparent.
Re:Ask HN: Why should I use Django?
by NumberCruncher on Thursday November 24, 2016 @04:56AM
(#13029404)
>>Django gives you the most options to work around the framework
So Django stands in my way and its' advantage is that it is easy the work around it?
No, I think you're misinterpreting the comment. Django guides you the right way and how it guides you works most of the time. However, when you do hit the edge, Django's very well written docs and thoughtfully designed architecture guide you in building around its limitations. For example, if you want to swap in Jinja over Django templates or SQLAlchemy over Django ORM. Really needing to do so is still the exception to the norm, but just know that Django does more here than most other frameworks.
If you are interested in understanding this a little deeper, I highly recommend picking up the Two Scoops book [1].
[1]: https://www.twoscoopspress.com/products/two-scoops-of-django...
I second the Two Scoops book. Django documentation is excellent (try the tutorial if you want a quick sense of django). Two Scoops help you understand why to do things in particular ways and make good design choices within all the things django can do.
Normally, if you are having a hard time with Django its because you're trying to work around it the wrong way. This takes time to learn but Django can be really elegant to work around and with.
The second option is Flask or Tornado which are pretty great too. Both would give you more freedom but also less structure. I find it better to have the structure because unless your an experienced engineer your Flask or Tornado project will turn messy quick. Django projects can turn messy too, but at least there is a more training and protocols for people to follow.
I use Flask/Tornado if I want to use Python and I know my project is a small service and will probably not get big.
I use Django if I want to use Python and I know the project will grow over time or I need features from the start like a database, migrations, cache, etc.