Live data from Hacker News

Django 4.1

djangoproject.com

111–120 of 126 posts

Re: Django 4.1

#111
post #79

Earlier quoted context omitted.

Why do a REST-like service? It makes sense as backend for a native iOS/Android app, and if you already have that REST endpoint then it can make sense to re-use it for the web-version of your app. But if you're not doing an iOS/Android app (most websites?), then I generally agree it's a lot more work compared to form-based / server-side-templates (though sometimes can give a _slightly_ better user experience, _if_ don…

In this day and age, mobile apps are _almost_ a must so REST is everywhere. A well-implemented REST app is pretty nice, business logic divorced from all UI and API lends itself nicely as a comfortable and maintainable programming environment. More often than not, being RESTful from the get-go tends to have positive returns down the line.

> In this day and age, mobile apps are _almost_ a must so REST is everywhere.

This really isn't true. Mobile apps are far more expensive to develop (everything is doubled, you're dealing with periodic forced updates outside of your development schedule, etc.) and there are a ton of apps which don't need anything you can't do in a browser.

One of the earliest things to do on a project is agreeing on what level of complexity makes sense for you. If your project doesn't have a known hard requirement for mobile apps and correspondingly large team sizes, a classic Django app is likely to let you iterate an order of magnitude faster at lower cost overall.

Re: Django 4.1

#112
post #8

If anyone is interested I updated my example Django Docker app to 4.1 at: https://github.com/nickjj/docker-django-example It includes running Django, Celery, gunicorn, Postgres, Redis, esbuild and Tailwind through Docker and Docker Compose. It's set up for development and production.

Thanks for this. I've been learning django and have been struggling to find a good example of a way to integrate modern js into django. Unfortunately not as much support as rails + esbuild

Re: Django 4.1

#113
post #88
post #70

looking at the release notes and the source, it looks like the asyncio interface is still using the old drivers, like psycopg2 for postgresql, and using a threadpool. we at SQLAlchemy came up with a way to interface asyncio frontend and backend (like asyncpg for the driver) while maintaining all the "in the middle" code as synchronous style. the dark secret is that for this approach you have to use greenlet to propag…

thanks for sqlalchemy. it's a shining star in the Python package ecosystem. > interface asyncio frontend and backend (like asyncpg for the driver) while maintaining all the "in the middle" code as synchronous style. the dark secret is that for this approach you have to use greenlet to propagate the "await" operations. It's been in our release for 18 months now with 1M downloads a day and there have been no problems r…

I was a bit ranty but the gist at https://gist.github.com/zzzeek/d9c98c43553e43e76600f03dfb5e1... lays out pretty much everything that happened.

Re: Django 4.1

#114

Django is single-handedly responsible for making me fall in love with programming. I am now using Elixir/Phoenix and 100% sold on the benefits of working with immutable data, but I still keep an eye on developments in the Python/Django ecosystem. Seeing Django edge closer to having a fully async stack is very exciting, and should make it a more viable platform for existing users as well as newcomers.

i have dabbled with web programming several times in the past, with a variety of frameworks (sinatra, rails, phoenix, fastapi, and now django). django is the first time i have felt truly productive - its architecture is the perfect balance between sinatra (doesn't do enough) and rails/phoenix (where i keep getting lost in a maze of generated code). also the orm really gets out of your way.

Re: Django 4.1

#115
post #14

Guess I best upgrade my production side-project from Django 1.5.9

You're giving me nightmares. I used to work for a company stuck on Python 2.7 and Django 1.something. They're still on it today.

Re: Django 4.1

#116

There are a lot of comments about async ORM, but to me the support for application-level (e.g. if you use forms, admin, DRF, Graphene) validation of DB-level constraints is a super cool feature that solves a real pain point - having to duplicate this logic at both levels, or forgetting to do so.

Except DRF doesn’t call clean() anymore (as of 3.0?), so you have to reimplement all your validation logic in your serializers anyway. Always seemed like a huge mistake to me for a framework that’s supposed to feel like a natural extension of Django.

Re: Django 4.1

#117
post #87
post #85

Earlier quoted context omitted.

Thanks a lot! By the way the version of the course on Udemy doesn't get updated. The full version of the course is at https://buildasaasappwithflask.com/ which includes lifetime free updates (it has over 10+ hours of extra updates and new features not on the Udemy version). Udemy is a really bad platform for instructors which is why I've been trying hard to decouple myself from them over time. As for a tutorial on us…

I was going to say that you should really camelcase your url, because it's hard to see what it's saying, but even when you do that... https://buildASASSAppWithFlask.com/ doesn't really help that much hahaha.

https://buildwithflask.com/ is the better name

Re: Django 4.1

#118
post #14

Guess I best upgrade my production side-project from Django 1.5.9

You're giving me nightmares. I used to work for a company stuck on Python 2.7 and Django 1.something. They're still on it today.

I'll qualify mine by pointing out that it doesn't have a database and is just a web client, a veneer, over a very secure API that really does all of the work. The Django I use is nothing but a template rendering thing.

Re: Django 4.1

#119
post #75
post #50

Earlier quoted context omitted.

exactly, it fires database call in a separare thread with coroutine awaiting this threads result.

Is the limitation on django ORM? Because I can run asyncpg/psycopg3 and sqlalchemy with async mode without any issues.

Its in the release notes: they don’t yet support async database clients. ;)

Re: Django 4.1

#120
post #105

Earlier quoted context omitted.

No. Async in Python is... eh. Rarely is it useful. Sometimes it is, though! Use it when it is useful...

Twisted is a pretty dope though. Wouldn’t migrate a non-async app to async but would absolutely look at async-by-default for new projects.

I love twisted and I have used it in some created ways, but I don't think I'd ever do async-by-default. Just too many headaches.
Post reply on HN