Questions tagged [asgi]

ASGI stand for Asynchronous Server Gateway Interface (ASGI), a "spiritual successor to WSGI, intended to provide a standard interface between async-capable Python web servers, frameworks, and applications."

An ASGI app is a a double, asynchronous callable (scope and coroutine). The callable has send and receive awaitables, thus the ability to wait for incoming events and send outgoing events. Events essentially are dictionaries with a predefined format that form the basis of the standard.

Official ASGI documentation

212 questions
1
vote
1 answer

Django Channels send message to another channel layer

let me simplify my question in one sentence: in one consumer, how can I access to another consumer to send message? basically, I have two consumers in seprated apps: note consumer in note app to manage system and crud notifications. chat consumer…
Weilory
  • 2,621
  • 19
  • 35
1
vote
1 answer

TypeError: 'Dash' object is not callable

I am trying to run a dash app in a uvicorn server. The app is very simple, just displays the text 'hello' to the screen. The code is as follows: from dash import Dash, html dash_app = Dash(__name__) dash_app.layout = html.Div(id='main-layout',…
Nathan
  • 33
  • 5
1
vote
1 answer

Problem with ASGI lifespan when i use custom middleware

I came across an interesting behavior. For the application, I wrote a custom middleware for processing the client, which did not wait for a response and disconnected class NoResponseReturnMiddleware(BaseHTTPMiddleware): _ERROR_MESSAGE: str = "No…
SmokyICE
  • 63
  • 1
  • 6
1
vote
0 answers

High Latency is being observed in AWS ARM Graviton Processor in Comparison to AMD Processor for ASGI based Django Application

I am running an Asgi-based Django Application(Rest Framework) using AWS Kubernetes in the production environment. Everything is running fine at AMD Processor(c5.2xlarge, c5.4xlarge). To decrease the cost we are trying to migrate the application to…
Manish Agrawal
  • 163
  • 2
  • 12
1
vote
0 answers

Is there a way could deploy Django project on namecheap in ASGI mode?

I'm trying to deploy my Django on Namecheap, the server should work but I got the following message traceback: [ERROR] [UID:12123][2655752] wsgiAppHandler pApp->start_response() return NULL. Traceback (most recent call last): File…
Abdelhamed Abdin
  • 556
  • 1
  • 6
  • 19
1
vote
2 answers

ChannelsLiveServerTestCase equivalent for pytest

In pytest-django there is a builtin fixture live_server though it seems like this server (that is actually based on LiveServerTestCase) can't handle web-sockets or at least won't interact with my asgi.py module. How can one mimic that fixture in…
ניר
  • 1,204
  • 1
  • 8
  • 28
1
vote
1 answer

Websocket 502 Bad Gateway

I've two container wsgi and asgi. wsgi server is running on 127.0.0.8000: gunicorn app.wsgi:application --bind 127.0.0.1:8000 Also asgi server is running on 127.0.0.1:8001 using of daphne: daphne -b 127.0.0.1 -p 8001 app.asgi:application I have a…
1
vote
1 answer

Serving file asyncronously with Django and uvicorn

I have a Django view that serves the content of a file. The Django application was running with WSGI until recently. This worked fine. Then I adapted my application to use ASGI running uvicorn. The file serving is now broken as it seems to loose the…
Oliver
  • 269
  • 3
  • 12
1
vote
1 answer

How to modify the content-length post modification of response in a middleware in FastAPI?

Example Code: # Here is a minimal reproducible example import json from starlette.datastructures import MutableHeaders from starlette.types import ASGIApp, Receive, Scope, Send, Message import datetime import socket import uvicorn from fastapi…
raghavsikaria
  • 867
  • 17
  • 30
1
vote
0 answers

Is there an equivalent to Python ASGI in Java?

In Python as we have WSGI or ASGI which differ in the way they handle the incoming requests to the web application, is there a Java equivalent to these two varying methodologies?
Rayman
  • 11
  • 2
1
vote
1 answer

How to mock (monkeypatch) a ContextVar in Pytest?

I am currently using asgi_correlation_id python package in my FastApi project. This package exposes a ContextVar called correlation_id. The usage is simple: from asgi_correlation_id.context import correlation_id id = correlation_id.get() Now, it…
raghavsikaria
  • 867
  • 17
  • 30
1
vote
1 answer

How to know which django middlewares are asynchronous enabled and which are not?

To see what middleware Django has to adapt, you can turn on debug logging for the django. request logger and look for log messages about “Synchronous middleware … adapted” . I have been trying to do just the same but without any luck. This is my…
1
vote
0 answers

channels slows app and creates many HTTP 500 errors

I use channels to inform the frontend of my app to force a page update. What I discovered is, that it is much slower in debug mode now and also I have tons of HTTP 500 in my webconsole. Occasionally I end up with: ERROR:daphne.server:Exception…
xtlc
  • 1,070
  • 1
  • 15
  • 41
1
vote
1 answer

Running FastAPI multiple process error after pyinstaller

I am running python FastAPI with UVICORN with multiple processors (5 processes),It is running smoothly from the code, but when I tried make the exe from pyinstaller and try to run the file, it is showing error. filename: main.py import…
AjayR
  • 4,169
  • 4
  • 44
  • 78
1
vote
1 answer

Trouble with Django ASGI (DAPHNE) Deployment on HEROKU

i've been trying to deploy for the last couple days and I just can't seem to get it working: on heroku , it says application deployed but then when i go into the logs I see errors. I try opening up the app (for example, admin page) and I get…
Karan V
  • 163
  • 2
  • 10