5 ms·
Thanks. Yeah exactly, Django is really intended for the full range developer. They make a lot of the design (software) decisions for you, which in turn causes
by Goopplesoft 13y ago
Thanks.
Yeah exactly, Django is really intended for the full range developer. They make a lot of the design (software) decisions for you, which in turn causes you to often end up in a much more manageable project (sometimes this backfires). Getting into a Django frame of mind is a bit more difficult since you have constraints but once you get it down, its generally straight forward. The other thing about Django is the packaging ecosystem. Things like advanced user perm/management, etc are baked in and very likely available in their myriad of packages (djangopackages.com). I would definitely recommend the beginner to start with django, mess it up a couple times and learn what ideal structures are like.
Flask on the other hand is extremely easy for the couple view project but requires someone quite competent in python to manage larger projects in it. You'll eventually have to create internal rules for your structure and code to keep things clean (MVC, etc) but the flexibility you'll have with it is amazing. The creator of Flask, Armin Ronacher, and it's devs are amazing at python and the languages idioms. You'll learn a lot going through the code and using its phenomenal design to create your own solutions. For example you won't be using flask packages with their own models/migrations, you'll be using pypi packages and design your models around your needs. Unless your project is really small, if you have everything in one file you're doing it wrong.
I guess the shorthand rules on flask vs django is:
- Very simple: use flask
- Novice on large api: use django
- Good at python large api: use flask
- Med/Large web project: use django
- Medium web project, good at python: use flask
- Good at python, large api: use flask
Check out https://github.com/imwilsonxu/fbone https://github.com/imwilsonxu/fbone and https://github.com/mitsuhiko/flask/wiki/Large-app-how-to https://github.com/mitsuhiko/flask/wiki/Large-app-how-to for some advise. Let me know if you have any specific questions.
- rahimnathwani 13y agoThanks for the advice and those links. The example's use of Blueprints for the users module is really clear. Previously I was confused by the documentation on Blueprints, and I simultaneously didn't 'get' what they were for, whilst wondering why there wasn't an obvious way to break down a project into smaller pieces of functionality. I think I'll follow your advice and use Django for now, just because it will be easier for me to find and use existing packages (e.g. django-allauth was a little easier to get working than flask-social). you won't be using flask packages with their own models/migrations, you'll be using pypi packages and design your models around your needs Are you talking about the distinction between, e.g. flask-social (a flask package) and python-social-auth (a python package, which requires me to define my own models)?