News for hackers. Stuff that matters.
Re:Django 3 by andrewgodwin on Monday December 02, 2019 @10:27AM (#21683166)
It's worth pointing out that the ASGI support in this release is very low level, and doesn't let you write async views or anything yet. We're still working on that.
Re:Django 3 by vonseel on Tuesday December 03, 2019 @12:21AM (#21690148)
> Note that as a side-effect of this change, Django is now aware of asynchronous event loops and will block you calling code marked as “async unsafe” - such as ORM operations - from an asynchronous context.

Am I correct to understand this as meaning async views can’t even read from the database yet? I guess the only use cases for ASGI views currently would be interacting with outside-Django backends that implement async support and such?

Re:Django 3 by petters on Monday December 02, 2019 @11:51AM (#21684148)
Thanks for your work on this.

If I am willing to hack a bit, is it possible?

What is the main obstacle? Is it all middleware?

Re:Django 3 by m_ke on Monday December 02, 2019 @11:57AM (#21684203)
Andrew gave a recent talk about it here https://www.youtube.com/watch?v=d9BAUBEyFgM

middleware is a part of it, then there's the ORM, caching and anything else that does IO.

Re:Django 3 by mattrp on Monday December 02, 2019 @12:27PM (#21684510)
If you’re in the hacking mode - what do you think of taking the Django orm and grafting it onto fast api - sort of like a stand-alone sqlalchemy but with all the ease and power or django’s querysets...
Re:Django 3 by m_ke on Monday December 02, 2019 @12:36PM (#21684608)
Django ORM is not async so using it with FastAPI would block the event loop. I guess you could wrap the calls in sync_to_async from asgiref but it wouldn't be pretty.

Another option is using something like Tom Christie's orm project (https://github.com/encode/orm), which is a wrapper on top of sqlachemy with a django like interface.

Re:Django 3 by hultner on Monday December 02, 2019 @06:39PM (#21688336)
FastAPI runs blocking IO/sync functions in a separate thread pool to work around this issue.
Re:Django 3 by mattrp on Monday December 02, 2019 @02:26PM (#21685882)
Thanks for the suggestion - very interesting.
Re:Django 3 by Ramiuz on Monday December 02, 2019 @01:31PM (#21685238)
Thanks for the info. I'll probably start fiddling with Django again, it has sure been a while for me.

Also, thank you and all the contributors for such amazing resource.