News for hackers. Stuff that matters.
Re:Django 4.0 will include a built-in Redis cache back end by BiteCode_dev on Friday September 17, 2021 @01:42PM (#28568473)
Sensible decision, although hardly a surprise or a killer feature for something that is a major version bump.

I assume the async story is going to be more fun.

By the way, if you are looking for a good key/value store with expiration without the need to setup redis, have a look at the excellent diskcache:

https://pypi.org/project/diskcache/

It is based on sharded sqlite files, and it's surprisingly capable, even in multiprocessing based env like a django site.

Sqlite is really showing up in all sort of use cases these days, like huey, a task queue that doesn't need any broker to be installed to be useful: https://pypi.org/project/diskcache/

Now things can get fun...

With supervisord (supervisord.org) you can manage multiple processes, and with fastapi + starlette, you can serve your WSGI site without a proxy pass, including static sites: https://fastapi.tiangolo.com/advanced/wsgi/

Then with shiv you can bunddle all that in a pyz file: shiv.readthedocs.io/

Meaning you can now just upload a pyz file to your server, run python on it, and that's it, you have a full stack deployed, with a web framework, db, caching, task queues, static file serving, which can handle around 100k visitor each day without a sweat.

No more infra needed. Just Python code, all bundle in one file.

That's really neat.

Re:Django 4.0 will include a built-in Redis cache back end by midrus on Friday September 17, 2021 @06:22PM (#28571573)
But then how do I do microservices in a monorepo based SPA server rendered running on kubernetes?
Re:Django 4.0 will include a built-in Redis cache back end by midrus on Saturday September 18, 2021 @02:32AM (#28574186)
Also, pair it with Unpoly, tailwind and slippers and you get a pretty amazing frontend setup as well.

https://unpoly.com/

https://mitchel.me/slippers/

Re:Django 4.0 will include a built-in Redis cache back end by lpasselin on Friday September 17, 2021 @05:14PM (#28570960)
Last year I tried Huey for a project where usage was very lightweight. Performance was more than enough with SQLite. Unfortunately Huey with SQLite was not great at handling unexpected crashes like server and docker restarts.

Switching to Redis solved all of these issues.

Maybe it's better now.

Re:Django 4.0 will include a built-in Redis cache back end by depr on Monday September 20, 2021 @04:20AM (#28591409)
>you can serve your WSGI site without a proxy pass, including static sites

What about HTTPS?

Re:Django 4.0 will include a built-in Redis cache back end by zentrus on Friday September 17, 2021 @03:01PM (#28569573)
Totally agree on hoping there is at least some movement forward on async--particularly async ORM. I love Django and DRF. It is my go-to for a lot of things, but the lack of async support is increasingly a problem for more organizations. Honestly, it would not surprise me that if a solid, kitchen sink web framework emerges in golang, Django will be abandoned rather quickly.

2 cents.

Re:Django 4.0 will include a built-in Redis cache back end by jgb1984 on Friday September 17, 2021 @06:37PM (#28571676)
I've been writing web applications using python and django for close to 15 years now. Smooth, concise and stable. Doing the same using a verbose and boilerplate heavy language like golang doesn't sound attractive to me, at all.

Not sure I understand the fuss about upgrades either, at my current job I've gone from python 2 to 3 and from Django 1.8 all the way to 3.2 LTS without too many headaches. The release notes provide detailed instructions on what is deprecated and what you should do to fix it.

Re:Django 4.0 will include a built-in Redis cache back end by midrus on Friday September 17, 2021 @06:25PM (#28571594)
Yes, maybe in 10 years when this Go framework catches up with all the features and becomes as battle proven, well documented, maintained and funded as Django and somehow we know is not yet another thing that will be abandoned next year.
Re:Django 4.0 will include a built-in Redis cache back end by midrus on Saturday September 18, 2021 @02:39AM (#28574221)
The Go hype is as bad as the frontend hype in my opinion.

If you're replacing Django with Go then either you never needed Django, or you have no idea what you're getting into.

At a previous job backend team decided to replace rails "because monolith slow ruby not fun anymore" with Go. Three years later they were still reimplementing things rails gives you since day 1. I've seen abominations as doing migrations as SQL scripts ran by cobbled together bash scripts because "as we don't have orms then orms are bad".

No need to say now they're about 4 years in and the one still running the business and making all the money is the monolith, not all the Go microservices around it.

Go is a replacement for c/c++, maybe java and for building infrastructure probably.

If you're using it for doing CRUD forms, you're using it wrong.

Re:Django 4.0 will include a built-in Redis cache back end by Abishek_Muthian on Saturday September 18, 2021 @08:49AM (#28575805)
GP (BiteCode_dev) made a valuable comment for how we can build a easily deployable python application with

>web framework, db, caching, task queues, static file serving, which can handle around 100k visitor each day without a sweat.

i.e. with 4-5 large dependencies of frameworks, libraries, software etc.

In Go you can off the bat reduce those dependencies to 1 or 2, even completely eliminate them, you get deployable package and async for free with faster development cycle and lesser headaches of managing dependencies in the long run.

Re:Django 4.0 will include a built-in Redis cache back end by readlikeasloth on Saturday September 18, 2021 @03:07AM (#28574319)
Out of curiosity: what features from Ruby are they reimplenting? I have no experience in Ruby but in a few other languages and framworks. And having encountered something missing yet when writing Go web services.
Re:Django 4.0 will include a built-in Redis cache back end by midrus on Saturday September 18, 2021 @04:32AM (#28574621)
I've not even mentioned Ruby.

Rails. Features of rails.This is exactly the problem...people focus so much on the language they forget the ecosystem they're in, and the ecosystems matters a lot more than the syntax or the performance.

Re:Django 4.0 will include a built-in Redis cache back end by midrus on Saturday September 18, 2021 @04:40AM (#28574656)
> And having encountered something missing yet when writing Go web services

How do you do form validations, translations, database access, migrations, email sending, background jobs that don't die on a deployment, user authentication, file uploads, caching, etc?

Of course all of this can be done, you just need to take 100 decisions and tie together 256 libraries many of them probably abandoned in a few years from now.

If you don't need any of that, then just what I said before: ok, you never needed rails from the get go.

Re:Django 4.0 will include a built-in Redis cache back end by arcturus17 on Friday September 17, 2021 @05:38PM (#28571193)
I love Django but it seems like such a limitation for certain workloads. You can often work around some of these issues with Celery but still…

.Net already offers a kitchensink with async, it’s growing a lot and is much more attractive than a decade ago.

Re:Django 4.0 will include a built-in Redis cache back end by metalliqaz on Friday September 17, 2021 @04:03PM (#28570282)
Interesting. I'll look into some of those projects.

I think you put the wrong link for Huey, btw.

Re:Django 4.0 will include a built-in Redis cache back end by BiteCode_dev on Friday September 17, 2021 @04:10PM (#28570354)