Top
Best
New

Posted by j4mie 2 days ago

What I love about Django(buttondown.com)
133 points | 114 commentspage 2
fmind-dev 1 day ago|
I'd love Django, if they had a better async story ... I used it for a recent project. While the framework is overall amazing, I had to switch to Go for better performance and easier async support.
giancarlostoro 1 day ago|
Django-Bolt is one of the interesting projects I found recently that helps boost RPS for Django by handling HTTP requests via Rust.

https://github.com/dj-bolt/django-bolt

harrouet 1 day ago||
Ah the old debate about function-based views and class-based views.

I totally understand why the OP would use only FBV, however when writing REST APIs you will want CBV to reuse base classes such as ListView.

daft_pink 1 day ago||
I like Django too, but find it difficult to deploy. While frontend frameworks can be easily deployed via a cdn and some microservice backends on something like cloudflare or aws, I find Django very difficult to deploy because it needs an underlying server running 24/7.
zelphirkalt 1 day ago||
What I like about Django are the following things:

(1) It seems whenever I need to adjust how something works, there is some field or method, that I can override, or meta class attribute to set. None of it seems too inflexible. Overriding or changing how things work somehow always feels like someone already thought of this special case I have, and has made it mostly easy to do. Often when I have such a customization case, I have this feeling: "AH, that's how it is supposed to be done in Django." instead of having a feeling of having to fight the framework.

(2) Just being able to use a normal template engine (I always use Jinja2 with Django), instead of having some wannabe HTML lookalike thing. I don't want to have to encode control flow inside HTML attributes. Why then make it look like HTML in the first place, if some JS framework then picks it apart? It is unnecessarily cumbersome to do that, and Django doesn't engage in that.

(3) The ORM is good, and flexible. Some traps for many queries though. But also escape hatches, which let one write ORM calls, that will translate to efficient SQL in most cases.

(4) Django makes it so easy (comparatively) to write a phenomenal searching and ranking function for ones database entities. Check for example the code of my blog [1]. One page of code, very adjustable to ones needs.

(5) Handling of routes is easy. `reverse` is very useful to not have to hardcode routes.

(6) Even when using third-party things like django-allauth it is easy to override templates, without having to modify the dependency itself. With foresight there exists a way to put ones own templates in a place that is discovered before the other package's templates.

(7) Adjustable django admin. I often have some "Tags" in my models, which are many-to-many. For example Posts-TagAssignment-Tag, where TagAssignment is a "throught table". In Django admin one can have a nice little modification [2] to make a very usable widget appear for assigning tags.

In short: It very much gets out of ones way.

[1]: https://codeberg.org/ZelphirKaltstahl/django-website/src/com...

[2]: https://codeberg.org/ZelphirKaltstahl/django-website/src/com...

tinodb 1 day ago||
> 3. Actions

It is somewhat explained as a convention or something built-in, but I can't find much about it elsewhere. Is it the author's own convention or am I missing something?

jbarham 1 day ago|
Yeah, I wondered about that too as normally Django "actions" mean admin actions (https://docs.djangoproject.com/en/dev/ref/contrib/admin/acti...). But in this case it seems the blog post is referring to this pattern: https://www.jmduke.com/posts/in-praise-of-actions.html (same author)
stana 1 day ago||
There are a lot of things to like about Django. Remember being blown away when I discovered Django Content Types[1]. Basically generic foreign keys to any model type.

[1]: https://docs.djangoproject.com/en/6.0/ref/contrib/contenttyp...

thraxil 1 day ago|
As someone who's used Django since 0.97 and loves it, Content Types are one of those features that I recommend avoiding. It looks amazing at first but you will eventually regret it.
cryo32 1 day ago||
My favourite part of Django is it's not Rails :)
0x4d4c 1 day ago|
Why is that? What's wrong with Rails?
panzerboy 1 day ago||
It's made by DHH.
cryo32 1 day ago|||
Actually I didn't know he was a prick. I'm not sure he is either - I haven't checked. I just really really don't like Ruby or Rails.

Ruby is like someone mashed up python and perl whilst on cocaine one day.

0x4d4c 1 day ago||||
And great bunch of other, awesome people.

I can take an argument of not buying a Tesla in order to avoid supporting Elons financial empire, but not using Rails because DHH made it is really hard to comprehend.

owebmaster 1 day ago||
Why is it hard? Elon got all the power he wanted. Not giving DHH the same free passes Elon got is a very reasonable take.
0x4d4c 1 day ago||
And boycotting open source project is the way to go?
brazukadev 1 day ago||
why not? there are so many available.
Nextgrid 1 day ago||||
Some people are just looking to be offended. You don’t have to read or agree with his drivel to use his software.

(Do you also check out the blogs/social media of every dev involved in every library you use?)

majorchord 13 hours ago||
> You don’t have to read or agree with his drivel to use his software.

No, but a lot of people choose to, and I don't claim to know if one way or the other is more right or righteous. But I think boycotts wouldn't exist in the first place if everyone could separate the art from the artist.

And since there's lots of boycotts in the world, I think it's safe to say that it's at least socially acceptable to boycott companies or people with practices you don't like.

Who are we to say they're wrong for it?

BoumTAC 1 day ago|||
The DHH hate is absolutely crazy on HN.

I don't understand how people can be so out of touch.

_old_dude_ 1 day ago|||
It's not hate, it's not wanted to be associated with:

see https://victorwynne.com/dhh/

rob 1 day ago|||
I need to go look up the CEO of my refrigerator, dishwasher, couch, car, cell phone, TV, shirt and jeans, and oat milk to see if they said anything I disagree with on social media so I can boycott them.
jasoncartwright 1 day ago|||
Do they have prominent blogs that are good to read to keep up in the industry you work in?
mystifyingpoi 1 day ago||||
Unironically, AI could automate the boycott.
zbentley 1 day ago|||
I mean, that might not be the worst thing?

Like, if you have something you regularly spend a lot of money on, it might be worth spending 2min on the Wikipedia article about it’s manufacturer to verify that it’s not made by child slaves or someone who sends all their profits to the KKK or whatever.

Doing that seems like basic prudence for an interconnected world, and a far cry from like … digging around Reddit threads looking for reasons to be outraged.

I have no opinion on DHH. I do think it’s good, actually, that lots of people are incorporating politics into their product use/purchase choices these days. Those decisions always had political consequences, so it’s good that people are now considering that.

Some people definitely have rubrics for making those decisions that I think are stupid, and some people do it dishonestly (e.g. performative public outrage over a random OSS contributor’s transphobic tweet while spending money on Harry Potter shit). But the fact that people are increasingly considering the social context of product use is still good, dumbasses would find other ways to be dumb regardless.

zbentley 5 hours ago||
Update: I read DHH’s blog. I now have an opinion on DHH: not good.
earthnail 1 day ago|||
I read the original post DHH links to. I don’t think it warrants the kind of hate he gets.

DHH has always been very outspoken in his opinions. That’s why he bashed Heroku so badly when he introduced Kamal. It’s what makes Rails such a clear minded framework.

In his political blog, he’s raising an issue that’s occupying all of western politics. And he’s very aggressive about it - just how he was very aggressive when he said “stop paying ridiculous amounts for stupid managed clouds”.

Instead of arguing where he’s wrong, people - including the blog post you cite - write “that’s hateful and racist” and refuse to engage beyond that. That is the very shut-up mentality he writes about.

It frustrates me so much to see this here on HN. HN is supposed to be a place to discuss, not blame others. This resistance to engage in a constructive discussion, even if the person with the differing opinion isn’t articulating them well, or has errors in their reasoning that upset you, is super harmful. It’s what gives all these far right parties their rise to power. They occupy the subjects then that their voters have on their mind, because everyone else doesn’t dare to talk about it.

We could have constructive discussions around such topics. But if we don’t, all that happens is that those who don’t feel heard - in this case rightfully so, because we chose not to hear them - will develop more and more extreme ideas.

blactuary 1 day ago|||
There is no "constructive discussion" to have with racists
brazukadev 1 day ago|||
> Instead of arguing where he’s wrong, people - including the blog post you cite - write “that’s hateful and racist” and refuse to engage beyond that. That is the very shut-up mentality he writes about.

What a weird statement. He has a platform, people that think his content is hateful and racist don't have a platform. He writes about kicking out normal people living their lives from places that he is not even from. Antagonizing people in position of power with this kind of mentality is what every sane person should do.

sylario 1 day ago||||
I did not really knew why DHH was controversial until a few month ago. He was heavily promoting the en translation of an old super far right french book. It is from the 70's and it is absurdly far right when you look up who wrote it and who promoted it in France at that time.

He is probably at a KKK level of racism.

panzerboy 1 day ago||||
I don't hate the guy (I don't know him personally so I cannot hate him), I just disagree with his opinions and I personally don't want to use anything that he makes or endorses. Easy as that.

I know that there are other people contributing to Rails, and that's their choice. Other people stopped contributing once DHH showed his true nature.

0x4d4c 1 day ago||
I presume, that you're not shopping anything on shopify?
panzerboy 1 day ago||
Good question, I don't know. I usually buy stuff online from a few big websites that are specific to my country.
owebmaster 1 day ago|||
Do you think DHH is out of touch too?
explorigin 1 day ago||
Django makes simple things easy and complex things hard. Django breaks the zen of Python with much "magic". I like DjangoORM but prefer FastAPI for the webby bits.
dzonga 1 day ago|
look at litestar [0] - if you want something more coherent than fast api

[0]: https://litestar.dev

sinpif 1 day ago||
Migration churn adds up over the years but overall it's nice and site-specific code is usually so small it fits very nice in LLM context.. easy to work with.
stavros 1 day ago|
I agree, Django is just fantastic. Nothing is perfect, but Django is just really well-designed, with components that fit together naturally into a balanced whole.
weatherlite 1 day ago|
Just wanted to say I saw your last stand up , you're hilarious!
ustad 1 day ago|||
Stavros Halkias! Very funny guy. And also a maker and HN god! Never would have thought.
stavros 1 day ago||||
Thanks, my love of comedy is only surpassed by my love of Django.
weatherlite 1 day ago||
Naa you lie you love twinkies more than Django
DoctorDabadedoo 1 day ago|||
What a random way to find out a stand up comedian I see now and then share a craft!
More comments...