Comments (6)
Hi @em1208! I was looking for different possibilities to make async views on DRF, and run over your comment here. I'm trying to understand it. Why is there no need to change the server to Uvicorn? Shouldn't the app run with ASGI in order to support asynchronous code?
from adrf.
Hi @gschurck, apologies for the delay in the reply, I just noticed the open issue. You can mix and match sync and async endpoints, as long as the version of Django you are using is supported and adrf is installed correctly, and there is no need to change your server to Uvicorn for async support, I believe, but you can try different configurations and report here if you want. I have not made any performance/configuration comparison yet, but that's something in my mind that I would like to do when I have time. I hope this helps!
from adrf.
Hi @mateokurti, I believe you are right, the app should run with ASGI to support asynchronous code, Uvicorn is one of the available options.
from adrf.
Since this topic is related to my question, I'm just asking it here. @gschurck did you manage to optimize those long API calls? In my case, I made one endpoint async as it takes ~10 seconds to be finished. However, my other sync endpoints stay blocked until the request on the async endpoint is finished.
Note that I'm running the app with Daphne ASGI, so it only has 1 worker in contrast with uvicorn which can be run with multiple workers. It just doesn't make sense to me why an async view should be a blocker for others. What am I missing?
from adrf.
I didn't really find for now, I am afraid that all the endpoints have to be async to be handled concurrently ? But not sure.
from adrf.
PR #19 has been merged which add support for mixing synchronous and asynchronous handlers.
from adrf.
Related Issues (20)
- ModelViewSet implementation HOT 3
- About Async Relational Fields HOT 1
- Does `adrf` support `django`(version 4.2)? HOT 2
- how can i write async serializers to go with my async ViewSet? HOT 1
- ViewSet incorrectly checks if ordinary properties and members on a class are async HOT 2
- Generics support HOT 4
- caching issue HOT 7
- Error with decorators in method HOT 1
- Is there a way to implement an asynchronous pagination in class based views like in drf for the sync case? HOT 2
- Support for authentication_classes HOT 1
- Synchronous Exception when using ModelSerializer HOT 4
- Support for GenericViewSet and ModelViewSet HOT 3
- ModelSerializer with SerializerMethodField and overriding to_representation HOT 11
- Authentication error with 0.1.3 release HOT 9
- Require CSRF when api_view(('POST')) on 0.1.5, but not in 0.1.4 HOT 1
- Make inheriting methods in ViewSet work HOT 2
- Serializer Bug with 'PrimaryKeyRelatedField' HOT 3
- Question ? 🙋🏼♂️ HOT 7
- Performing actual queries in `get_queryset` method
- serializer using ForeignKey causes SynchronousOnlyOperation error HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adrf.