Skip to main content

All Questions

-1 votes
1 answer
36 views

How to make the function stop immediately, when in websocket stop requested?

I want to stop running the generating function immediately, whenever stop_requested in the websocket. class ImageGeneration(BaseAIGeneration): async def process(self, websocket, prompt): ...
M S's user avatar
  • 1
2 votes
0 answers
103 views

Asyncio coroutine execution stopped and didn't return any error

I'm facing an odd behavior on one of my applications. So I have an application that has an POST entrypoint that receives a list of order id's and after processing each order it must inform an external ...
Pedro Silva's user avatar
0 votes
0 answers
33 views

Puppeteer not working with Django Viewset

I am trying to write a Django REST endpoint which will convert the HTML content to PDF and then return the Streaming file response to download the report. For this purpose, I am using Puppeteer, which ...
Zain Ul Abidin's user avatar
1 vote
1 answer
64 views

Python async performance doubts

I'm running an websocket application through Django Channels and with Python 3.12. I have a ping mechanism to check if my users are still connected to my application where at a fixed time interval the ...
Pedro Silva's user avatar
1 vote
1 answer
264 views

Why we need sync_to_async in Django?

The document said: The reason this is needed in Django is that many libraries, specifically database adapters, require that they are accessed in the same thread that they were created in. Also a lot ...
PaleNeutron's user avatar
  • 3,235
1 vote
1 answer
31 views

Djnago coroutine to query data from DB in batches and yield as an iterable

I am using Django 4.2 with python3.8. I have a Mysql8 DB containing a Model as class A(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) name = models....
Dhairya Gupta's user avatar
-1 votes
1 answer
42 views

AsyncIO: Program still runs in a synchronous manner despite using AsyncIO in Django

I have created an API named APIDummyWait5. Now I want to test the following - I want the API to return the result in few milliseconds. - While the function that is being called inside the API should ...
Glen Veigas's user avatar
1 vote
0 answers
61 views

Whats the difference between asyncio and multithreading in python? [duplicate]

Multi-threading import threading def heavy_computation(): # A CPU-bound task result = sum(x * x for x in range(10**6)) threads = [] for _ in range(4): t = threading.Thread(target=...
40 Mike Mike's user avatar
0 votes
1 answer
216 views

How to use Async Redis Client + Django in python?

I'm trying to create a distributed semaphore using Redis to use in my Django application. This is to limit concurrent requests to an API. I'm using asyncio in redis-py. However, I want to create a ...
user7722867's user avatar
0 votes
0 answers
178 views

Understanding sync_to_async method in Django?

I have never worked with asyncio and/or asynchronous methods with django and am having a little difficulty understanding. I am trying to convert a synchronous utility function (create_email_record) ...
master_j02's user avatar
0 votes
0 answers
51 views

how to use AsyncIOScheduler in Django?

I am developing an API using Django Rest Framework that periodically calls an asynchronous method through AsyncIOScheduler (a component of APScheduler), making it run every few seconds. However, it is ...
kai kang's user avatar
0 votes
0 answers
42 views

ValueError: The view test_app.views.sse_stream didn't return an HttpResponse object. It returned an unawaited coroutine instead

I' ll post in this section the full error, since the "title" section has a characters size constraint. Here it is: ValueError: The view test_app.views.sse_stream didn't return an ...
iulian's user avatar
  • 11
1 vote
1 answer
230 views

How to run multiple websocket client connections?

I have a Django service (let's call it the "main" service) running an HTTP server & a WebSocket server using django-channels. I also have a bunch of other django services(call them ...
sudoMode's user avatar
  • 106
1 vote
0 answers
218 views

Why Django Signals async post-save is locking other async ORM calls?

I have a Django 5 application that use websockets using channels, and I'm trying to switch to AsyncConsumers to take advantage of asyncronous execution for I/O or external API tasks. I already wrote a ...
EdoG's user avatar
  • 355
0 votes
1 answer
159 views

Im not sure I understand why Django wont let me do asynchronous database transactions

I am trying to create a function that will get_or_create a user record for my discord bot in my django User model as soon as someone runs the !home command - but I am encountering an issue that (as ...
Syllogism's user avatar
  • 184

15 30 50 per page
1
2 3 4 5
8