Ask HN: Django vs. Flask
You can get pretty far with Flask. You&#x27;ll need an ORM, so you&#x27;ll likely chuck SQLAlchemy in. Then you&#x27;ll want easier access to SQLAlchemy, sorta like, you know, django does it, so you pick up <a href="https:&#x2F;&#x2F;github.com&#x2F;mitsuhiko&#x2F;flask-sqlalchemy" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mitsuhiko&#x2F;flask-sqlalchemy</a>.<p>But you can&#x27;t use pure SQLAlchemy models (easily), since this otherwise great extension for flask doesn&#x27;t support it (<a href="https:&#x2F;&#x2F;github.com&#x2F;mitsuhiko&#x2F;flask-sqlalchemy&#x2F;pull&#x2F;250" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mitsuhiko&#x2F;flask-sqlalchemy&#x2F;pull&#x2F;250</a>, yes I&#x27;m in the thread).<p>You&#x27;ll fork it or brew your own code to get declarative models working right. Kinda time consuming, but at least your models can be pulled in by <i>any</i> python code, and aren&#x27;t tied down to a framework (That&#x27;s what you were avoiding from the first place, wasn&#x27;t it?)<p>Then you&#x27;ll pick up WTForms (<a href="https:&#x2F;&#x2F;wtforms.readthedocs.io&#x2F;en&#x2F;latest&#x2F;" rel="nofollow">https:&#x2F;&#x2F;wtforms.readthedocs.io&#x2F;en&#x2F;latest&#x2F;</a>), another excellent library. And you&#x27;ll miss having Django ORM&#x27;s rich form and model-backed validation. So you&#x27;ll try wtforms-alchemy, <a href="https:&#x2F;&#x2F;github.com&#x2F;kvesteri&#x2F;wtforms-alchemy" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;kvesteri&#x2F;wtforms-alchemy</a>.<p>Then you&#x27;ll begin to see why Django makes sense after using Flask for a while. Django pulls in all the essential stuff and supports it well.<p>And top of that, django&#x27;s addons like django-extensions (<a href="https:&#x2F;&#x2F;django-extensions.readthedocs.io" rel="nofollow">https:&#x2F;&#x2F;django-extensions.readthedocs.io</a>), which gives you Werkzeug&#x27;s debugger if you use .&#x2F;manage.py runserver_plus. And .&#x2F;manage.py shell_plus, which integrates with ptpython&#x2F;ipython&#x2F;bpython (<a href="https:&#x2F;&#x2F;django-extensions.readthedocs.io&#x2F;en&#x2F;latest&#x2F;shell_plus.html" rel="nofollow">https:&#x2F;&#x2F;django-extensions.readthedocs.io&#x2F;en&#x2F;latest&#x2F;shell_plu...</a>).<p>Django rest framework, DRF for short (<a href="http:&#x2F;&#x2F;www.django-rest-framework.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.django-rest-framework.org&#x2F;</a>), which is very mature at this stage, runs circles around Flask API. Flask API is inspired by DRF. You could also try <a href="https:&#x2F;&#x2F;flask-restful.readthedocs.io" rel="nofollow">https:&#x2F;&#x2F;flask-restful.readthedocs.io</a>, but after all that, you&#x27;ll be missing that tight model support.<p>You&#x27;ll <i>love</i> flask. The code is top tier and exemplary. The testsuites are a dream and are very clear. Documentation is awesome. It feels good to code in it. But django feels good to code in as well.<p>Django&#x27;s ORM is very mature. It&#x27;s easier than SQLAlchemy, and despite SQLAlchemy&#x27;s purity, and documentation - even better than flask&#x27;s - Django&#x27;s ORM does the trick for pretty much anything, even foreign databases I&#x27;ve interacted with. Another thing, QuerySet&#x27;s are a charm, a lot of django&#x27;s addons like django-filters, django-rest-framework and django-tables2 are built on top of its versatility.<p>Another thing Flask community ends up having to clone from Django is django-debug-toolbar <a href="https:&#x2F;&#x2F;github.com&#x2F;django-debug-toolbar&#x2F;django-debug-toolbar" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;django-debug-toolbar&#x2F;django-debug-toolbar</a>. See <a href="https:&#x2F;&#x2F;flask-debugtoolbar.readthedocs.io" rel="nofollow">https:&#x2F;&#x2F;flask-debugtoolbar.readthedocs.io</a>.<p>Again, I love flask, but when I realized that I&#x27;m just going to end up reinventing django with my flask app anyway, I started going with django on new projects. I haven&#x27;t turned back, but still check out flask and sqlalchemy to see what&#x27;s happening now and then.