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
0
votes
0 answers

Deploying asgi django on heroku

I'm unable to deploy asgi django on heroku. Build is successful but it shows Application Error after deployment. Procfile: web: daphne quickmeals.asgi:application --port $PORT --bind 0.0.0.0 -v2 worker: python manage.py runworker channel_layers…
0
votes
1 answer

ValueError: WSGI wrapper received a non-HTTP scope on converting Flask Wsgi Application to Asgi Application

I am developing a web server using flask 2.0.2 and deploying using hypercorn. I want to deploy it as asgi application. My main.py looks like this: from flask import Flask from asgiref.wsgi import WsgiToAsgi app =…
0
votes
1 answer

Websockets with Falcon & Daphne behind a K8s Ingress

My Falcon based ASGI app is executed via Daphne and works fine when it is run locally and accessed via localhost. The app is packaged in a container and run in a K8s cluster behind an Ingress. On K8s the app is not running at the root of the domain,…
Achim
  • 15,415
  • 15
  • 80
  • 144
0
votes
0 answers

How to check the every variable like in a jupyter notebook when I am developing a FastAPI Server?

I am just getting started with fastapi on python to develop simple ASGI endpoints. I notice that the handler function codes can only be run (and hence tested) when I am running the module with uvicorn. Example, take this…
Della
  • 1,264
  • 2
  • 15
  • 32
0
votes
2 answers

How to pass extra data to fastapi APIRouter?

This is my 1st fastapi exercise. I've my old model serving code implemented with Flask as following: class HealthCheck(Resource): def __init__(self, **kwargs): super(HealthCheck, self).__init__() self._model = kwargs['model'] …
soumeng78
  • 600
  • 7
  • 12
0
votes
1 answer

Django 3 + websocket (asgi, uvicorn) (circular import error for all imports in production server)

The project is running on the local server, but when I try to run on the production server, it gives an error ImportError: cannot import name 'LastModMixin' from partially initialized module 'snippets.models.abstracts' (most likely due to a circular…
0
votes
0 answers

Django Channels ValueError: No route found for path

I follow this tutorial to build a chat system https://channels.readthedocs.io/en/stable/tutorial/part_1.html It works fine when the room name is a string without white spaces, say "Room1". WebSocket HANDSHAKING /ws/chat/Room1/ WebSocket CONNECT…
0
votes
0 answers

Django path converter raises SynchronousOnlyOperation

I'm migrating an existing WSGI server to ASGI and I'm running into a problem where ORM usage in path converters raises a SynchronousOnlyOperation exception. My converter code is something like this class ModelPkConverter: regex = r'\d+' …
Konstantin K.
  • 335
  • 2
  • 6
0
votes
1 answer

Django Channels error appears in separate Django project (broken pipe error)

I'm relatively new to ASGI and Django Channels, so this is probably a very basic question. I got ASGI running thanks to Django Channels in one of my Django projects and it works fine. I then want to work on my old project, which doesn't yet use…
Dylan
  • 2,315
  • 2
  • 20
  • 33
0
votes
1 answer

Django is becoming synchronous on importing channels

On including the channels in my project (installed_apps), it has become synchronous. I'm using django 3.2.4. if I remove those channels and try, my django server is able to process multiple requests asynchronously(when I'm hitting from postman). Any…
0
votes
1 answer

django async support - not fully understanding the main concept

which is main concept of django asgi? when there are multiple tasks to be done inside a view, handle those multiple tasks concurrently thus reduce view's response time. when there are multiple requests from multiple users at same time, hendle…
minkoonim
  • 5
  • 2
0
votes
1 answer

Django channels doesn't work properly with production environment

i have a really big problem with channels. when I try to run asgi server in production the problems come up but there is no problem when running in terminal. first let me show you a little code class LogConsumer(AsyncConsumer): async def…
Xeus
  • 92
  • 1
  • 6
0
votes
1 answer

Django Channels App Websocket Connection Failing

I believe I have a similar issue to the one found here and here. The gist is that I'm running a Django app with channels on an Amazon-ec2 instance and the websockets are failing to connect. Most of my code regarding the websockets comes from the…
huitlacoche
  • 173
  • 1
  • 2
  • 15
0
votes
1 answer

why uvicorn port 80 options works on another port?

I tried fastApi and uvicorn. But I'm wondering why when i execute uvicorn in port 80, it works on port 52384. 52384 shows the api response but 80 does not. in the dockerfile, I added EXPOSE 80 80. // terminal vscode ➜ /app (master ✗) $ lsof…
ryosukemitake
  • 49
  • 1
  • 6
0
votes
1 answer

use HTTPS in flask asyncio running

I use flask in windows 10. I want to use HTTPS for the protocol. However, I use flask+asyncio so could not use "ssl=..." method. How could I achieve HTTPS in my case? import hypercorn.asyncio from app import app, client, telegram_handler # must…
Django
  • 1
  • 6