3 ms·
I love flask, I built http://www.gauthify.com http://www.gauthify.com 's API and http://Uphound.com http://Uphound.com using it. I think its great for small and
by Goopplesoft 13y ago
I love flask, I built http://www.gauthify.com http://www.gauthify.com 's API and http://Uphound.com http://Uphound.com using it. I think its great for small and large apps. With that said, I do think that at this point you might consider using something like Django instead.
- rahimnathwani 13y agoThe GAuthify home page looks awesome, and it's a great concept. I'm curious about your comment that Flask is 'great for small and large apps' and your advice 'at this point you might consider... Django'. From my limited experience of trying to build things with both, my impression is that Django has a steeper learning curve because of the project/app distinction, and urls.py but that, after some time, the additional structure this imposes makes it less likely that my code becomes a mess. With Flask, it was super-fast to get started, and to add functionality incrementally, but at some point I realised my code was all in one file, which didn't seem right. If, as you say, Flask is suitable for large projects like GAuthify, how do you structure your code so as to avoid the problem I faced? Under what circumstances would you use Django for a project instead of Flask?
- Goopplesoft 13y agoThanks. 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)?