5 ms·
How is Django now? I’m a long time python dev (data eng space) but new-ish to web dev. I started a Flask project 2 years ago and found it to be pretty full of f
by appplication 3y ago
How is Django now? I’m a long time python dev (data eng space) but new-ish to web dev. I started a Flask project 2 years ago and found it to be pretty full of footguns, mixed messaging on best practices for scalable apps, and the ecosystem feels overbloated with vapor ware extensions.
Is this just a Flask problem, or does Django have the same issues?
- coder_san 3y agoDjango is fantastic. It's much bigger than flask, and has one of the best ORMs I've ever used. Also comes with a built in admin panel which is always nice. You will want to use Django REST Framework to make REST APIs, but if getting a site up and running is all you want, it's perfect. If you want to purely make APIs though, give FastAPI a try.
- sgt 3y agoSame opinion. Django is marvelous for getting stuff done.
- SCUSKU 3y agoI use django professionally and for personal projects. I started with Flask and then did FastAPI for a while, but I like django the most since it's the most mature. The ORM and django admin are killer features out of the box that the other frameworks don't have. I will say though that FastAPI is really nice, especially if you need async support. However, I have found that using django ninja [1] adds a lot of nice to haves that FastAPI has to django that makes it much more fun to use again. [1] https://django-ninja.rest-framework.com/ https://django-ninja.rest-framework.com/
- VerminOctopus1 3y ago+1 for django ninja. I built a little side project with it a few months back and was super impressed by how easy it was to get up and running. I didn’t want to leave the Django ORM behind so was very pleased to find this project.
- ak217 3y agoHaving used Node/express, Rails, Flask, and Django extensively, I have been very impressed with Django. The framework itself is good, but the superpowers come from the ORM and DRF, and a few other great plugins. The stuff you can do with the ORM and DRF is nothing short of incredible. Now, you could argue that the framework shouldn't be tightly coupled to the ORM, and sqlalchemy does provide some stiff competition as an example of that, but in my experience Django ORM edges out sqlalchemy in terms of usability. There are some footguns around N+1 queries, but they are general to all database interfaces and pretty easy to avoid IMO.
- pphysch 3y agoDjango is excellent. There are some rough edges and signs of age, but the core ORM is fantastic to develop with.
- thewataccount 3y agoYou simply can't beat Django's ORM for general stuff. It's too awesome. This alone makes it so hard to choose anything else. I know django doesn't have that "shiny factor" to it these days - but it's very reliable. > mixed messaging on best practices for scalable apps The WSGI stuff can be kinda confusing and is used across a lot of python frameworks including django and I think flask? My advice for "simple scaling" is to start with a separate Postgres instance, and then use gunicorn. Use celery immediately if you have any "long lived" tasks such as email. If you containerize your web layer, you'll be able to easily scale with that. Finally - use redis caching, and most importantly - put Nginx in front! DO NOT serve static content with django! > the ecosystem feels overbloated with vapor ware extensions. This still exists to some degree for some more niche stuff, largely because of it's age. Although impressively they'll generally still work or work with minimal modifications. It's popular enough and old enough that most normal things you'd want to do have decent extensions or built in support already.
- Zetice 3y agoNot only can you not beat Django's modeling in Python, but I simply cannot find an in-kind solution in JS either. Nothing covers all of the bases the way Django does, or more specifically DRF/graphene-django. The current state of the art is apparently Prisma, but it covers only a small part of the full picture.
- murkt 3y agoEhh, Django ORM always was one of the worst parts of Django.
- mrweasel 3y agoTrue, but it's the best ORM currently available for any language. It might not be the fastest, but it is the one that's has the highest level of developer comfort. Using Django is probably the reason why I can stand using SQLAlchemy, it's way to complicated for everything I do and it's just not a nice an experience.
- 3y ago
- bjourne 3y agoDjango is the opposite. It holds your hand and tells you how to structure your "app", templates, database, and media assets. And django-admin is godsend. It's awesome when you are on the beaten path cause everything just works. But if you step of the beaten path you will have to tweak various obscure settings and create weird hooks to override Django's defaults. Flask is the opposite. Just a very well-written web server and it's up to you to decide things like project structure, template engine, orm, asset manager, etc. Personally I prefer Django since most of my web applications are quite mundane and don't require the flexibility Flask can provide.
- kstrauser 3y agoI've described that as Django is fantastic for writing Django apps. If the thing you want to do can be completely modeled in the defaults, it's impossible to beat. If that's only 99% true, you might want to investigate other options.
- winrid 3y agoYou can always build 99% of the App (crud, ui stuff) in Django and the 1% be its own service.
- winrid 3y agoI can't give Django enough praise. I never thought I'd be writing Python. I've mostly used Node, Java, and Rust, with about 12yrs experience now. Only about one year with Python and Django recently. I am so much more productive than anything else I've tried. Using anything else feels like a mistake for web apps or CRUD apis. I also use type hints. I use Django + django-ninja + django-unicorn for dynamic UIs. Building sidewaysdata.com with django right now! Govscent is in Django too, the ORM is nice to combine with AI stuff already in python. I'm also following the Ash framework which looks promising.
- doteka 3y agoYou are also running sidewaysdata.com with DEBUG turned on in production, apparently ;)
- sgt 3y agoIs django-unicorn similar to htmx?
- winrid 3y agoUnicorn is like htmx specific to Django. It reminds me more of Hotwire or Meteor. Very productive! Not 1.0 yet, but I'm happily using it in prod.
- gen220 3y agoI've used Flask/SQLAlchemy and Django a bunch in my day, professionally and on the side. It's a different strokes for different folks sort of deal. Django is very opinionated, in a way that is "eventually" correct (i.e. they might have had some bad opinions many years ago, but they have generally drifted in a better direction). If the opinions don't align with what you're building, the escape hatches are not generally well-documented or without penalty. Flask is minimalist and flexible. Once you find a "groove" to building with it that fits your sensibilities, it's quite, quite nice. That being said, the most recent versions of flask have excellent documentation, imo, and the tutorial is a bit more opinionated in a highly productive way. The "patterns" section of the docs is also super useful for productionizing your app. Personally, I prefer the combo of Flask+SQLAlchemy, and eventually Alembic once you decide that's good for your app's maturity level. I respect Django a lot, I just enjoy the explicitly "less magical" aspects of a Flask stack, which is an opinion-based trade-off imo.
- 0cf8612b2e1e 3y agoAs a minor rebuttal, I get sick of Flask because it is bring-your-own everything. Nothing I write will ever NeedToScale(TM) or be off the beaten path from the Django Way. No interest in plugging in an alternative template language, form validation, email library etc. When I get stuck in Django, I know someone else has experienced the exact same situation. With Flask, I have to pray to deity that Miguel Grinberg has written about a similar enough situation. The majority of documentation foregoes Flask Blueprints.
- FredPret 3y agoI'm a self-taught noob as far as web engineering goes, but between this course (cs50.harvard.edu/web/2020/) and ChatGPT, I got several commercial Django sites live in a very short amount of time and effort.