79197327

Date: 2024-11-17 13:47:18
Score: 1.5
Natty:
Report link

If I were you I would consider using Celery a powerful asynchronous task queue for Python. It allows you to run functions in the background without blocking your main web request or causing the page to hang.

Here’s a basic approach (You can find more in the docs)

Install Celery and a message broker like Redis

Move your response-generating loop into a Celery task

Trigger the task from your Django view without waiting for it to complete.

Reasons:
  • No code block (0.5):
  • Low reputation (1):
Posted by: alex