Live data from Hacker News

Django 4.0 release candidate 1 released

djangoproject.com

41–50 of 126 posts

Re: Django 4.0 release candidate 1 released

#41

Earlier quoted context omitted.

agreed, I'm more convinced now that django is really enough and get shit done even if there a poor support of async, more convinced after reading this blog post that async python is not faster (was on hn) : https://calpaterson.com/async-python-is-not-faster.html

It's not significantly faster (or slower), it's the author that doesn't know how to run a benchmark. You can read my take on his take [0]. Leaving that aside, async is very advisable (even a must) if your backend throws requests against external and potentially blocking services and you want to keep answering your own clients without scaling for no reason. [0] https://news.ycombinator.com/item?id=29128107

This is a question that's largely impossible to answer, but there's a performance vs developer (or business) time calculation to be made.

More aptly, if one can throw another physical server at it, is it worth fixing the underlying performance issue?

Sometimes the answer is yes. If you're at a place with even a thousand physical servers running your process and you can save 2% overall performance with a rewrite, that's saving you 20 physical servers worth of performance.

But often the answer is that it's not worth it. That 2% performance increase on a set of 10 servers is not calculable, and more often even a 10% performance benefit is only noticeable on some specific task, not as a constant overhead.

On the other hand, developer time is expensive and can often be best spend on core functionality.

If Django is, let's say even 20% slower than an async framework like FastAPI, but it's going to save three developers a week of development time to implement a feature in Django, then that's probably a much cheaper solution.

I've used Django, Flask, Sanic and FastAPI[1] and today I often choose FastAPI for my projects, but I think Django is still what I'd turn to if I needed to make a full fledged web application quickly, despite its performance not being as good as FastAPI.

[1] Before I learned Django, I also used Zope, and TurboGears.

Re: Django 4.0 release candidate 1 released

#42

I love Django and have been using it for many many years. Lately, however, I’ve been finding it increasingly difficult not to be annoyed by some aspects of the developer experience. For example I’d choose React + Typescript over Django templates any time of the day.

Django templates are the worst. Django is great. Just don't use its templates or form systems. Indeed react is a great replacement for both.

I disagree with that. They are fine for regular forms, tables (as in grids), etc. I usually have a few views using plain old Django templates (with a couple of template tags for additional functionality), and then maybe one view with a full blown SPA in it. No need to build your login page etc in React.

Re: Django 4.0 release candidate 1 released

#43
post #27

I love Django and have been using it for many many years. Lately, however, I’ve been finding it increasingly difficult not to be annoyed by some aspects of the developer experience. For example I’d choose React + Typescript over Django templates any time of the day.

You shouldn't be downvoted for saying this. As a server-side developer of 20 years the server-side templating languages have a lot to learn from the frontend experience. And I say this as a user of Smarty, Jinja2 and now Twig & nunjucks. Template inheritance is fantastic. But... Being able to develop and test standalone HTML components using Storybook is a whole lot nicer than splitting a server-side template into co…

I'm talking entirely out of my rear end, but I'm curious if there is any validity to some of these projects that let you run pythonic code in the browser, either through Webassembly or brpython. For example, this projects https://github.com/stefanhoelzl/vue.py claims to let you write Vue.js in Python in the browser, which then gets turned into regular Vue.js components. I imagine a performance penalty, but a developer performance benefit of allowing something else to run on top and make a more composable experience.

Or is this barking up the wrong tree entirely?

Re: Django 4.0 release candidate 1 released

#44

I love Django and have been using it for many many years. Lately, however, I’ve been finding it increasingly difficult not to be annoyed by some aspects of the developer experience. For example I’d choose React + Typescript over Django templates any time of the day.

Django templates are the worst. Django is great. Just don't use its templates or form systems. Indeed react is a great replacement for both.

I disagree. The way you can extend sections of other templates without creating an inheritance chain works very well (and I missed in template systems, for Java, for example)

Re: Django 4.0 release candidate 1 released

#45
post #7

There are cooler frameworks, there are more minimal frameworks, there are more "modern" frameworks. Whatever that means. Yes I would like to work with FastAPI, it is great. But... Django gets the shit done. There are plenty of developers to find for it. Lots of good quality plugins. Every problem you have, infrastructure wise, is often already solved and there is a blog post of it. Its good parts and its bad parts ar…

agreed, I'm more convinced now that django is really enough and get shit done even if there a poor support of async, more convinced after reading this blog post that async python is not faster (was on hn) : https://calpaterson.com/async-python-is-not-faster.html

Interesting, those results are the opposite of the techempower frameworks, which find that the async frameworks are always faster: https://www.techempower.com/benchmarks/#section=data-r20&hw=.... Though in general I'm not sure about the value of bringing async to Django. If you want more performance, you can already either throw more machines at it, or isolate some part in a service that can be written with FastAPI/Go/something. Async in general makes the code more complex and harder to write, which seems to be the opposite of what Django is for.

Re: Django 4.0 release candidate 1 released

#46
post #41

Earlier quoted context omitted.

It's not significantly faster (or slower), it's the author that doesn't know how to run a benchmark. You can read my take on his take [0]. Leaving that aside, async is very advisable (even a must) if your backend throws requests against external and potentially blocking services and you want to keep answering your own clients without scaling for no reason. [0] https://news.ycombinator.com/item?id=29128107

This is a question that's largely impossible to answer, but there's a performance vs developer (or business) time calculation to be made. More aptly, if one can throw another physical server at it, is it worth fixing the underlying performance issue? Sometimes the answer is yes. If you're at a place with even a thousand physical servers running your process and you can save 2% overall performance with a rewrite, that…

That remind me of a meeting a few days ago where we were discussing if we should add another server or spend a bit more time developing something. After some time, I asked about the server cost, and it ended up being something like 100€ a month more to not have to worry about performance for the next year. In that case the decision was easy enough, but maybe some organisations have fixed server budgets and developers. For those, being able to trade developer time for performance, even if it seems inefficient, may be better than nothing.

Re: Django 4.0 release candidate 1 released

#48

I love Django and have been using it for many many years. Lately, however, I’ve been finding it increasingly difficult not to be annoyed by some aspects of the developer experience. For example I’d choose React + Typescript over Django templates any time of the day.

Django templates are the worst. Django is great. Just don't use its templates or form systems. Indeed react is a great replacement for both.

How many tools do I need to install to publish a front-end made with React?

Re: Django 4.0 release candidate 1 released

#49
post #30

Earlier quoted context omitted.

You could use Django just for the backend and have your frontend code be written in React+Typescript, no?

But that means throwing out a large part of Django and writing lots of "interconnect" code. At that point I think it's better to choose a different backend, one that will generate typed Typescript client code (or use Typescript on the server and some clever metaprogramming).

The thing is that there's no TypeScript backend that gives you as much stuff out of the box as Django. You're either going to spend time on how to communicate between Django and TS, or spend time on how to recreate Django functionality in TS.

Re: Django 4.0 release candidate 1 released

#50
post #46
post #41

Earlier quoted context omitted.

This is a question that's largely impossible to answer, but there's a performance vs developer (or business) time calculation to be made. More aptly, if one can throw another physical server at it, is it worth fixing the underlying performance issue? Sometimes the answer is yes. If you're at a place with even a thousand physical servers running your process and you can save 2% overall performance with a rewrite, that…

That remind me of a meeting a few days ago where we were discussing if we should add another server or spend a bit more time developing something. After some time, I asked about the server cost, and it ended up being something like 100€ a month more to not have to worry about performance for the next year. In that case the decision was easy enough, but maybe some organisations have fixed server budgets and developers…

Server upgrade costs can vary wildly depending on what it entails. The cost of adjusting your EC2 Auto-Scaling Group maximum instance count will be very different than contacting HPE sales department.
Post reply on HN