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

How do Uvicorn workers work, and how many do I need for a slim machine?

The application I deploy is FastAPI with Uvicorn under K8s. While trying to understand how I want to Dockerize the application I understood I want to implement Uvicorn without Gunicorn and to add a system of scale up/down by the load of the requests…
DorZ
  • 194
  • 1
  • 12
2
votes
1 answer

How is it possible to compare ASGI framework with ASGI server?

How is it possible to compare ASGI framework with ASGI server? What the points of comparison? What the reason of comparison framework and server? In this benchmark i see Starlette (ASGI framework) and Uvicorn (ASGI server), actually Starlette works…
ice1x
  • 21
  • 6
2
votes
1 answer

Is it possible to send an MQTT message with mqttasgi inside a Celery Worker that use Redis Backend

I am using mqttasgi library in Django to receive a large number of messages, and process them with a REDIS queue and I would like to publish this information back to another TOPIC. Is this possible? If yes, how can I do it ? For the moment I am only…
Jonathan Prieto
  • 233
  • 4
  • 14
2
votes
2 answers

trying to use channels in Django caused these errors

I was trying to use channels in Django, To do that I followed a tutorial and made these changes in the asgi.py file from channels.routing import ProtocolTypeRouter application = ProtocolTypeRouter( { "http":get_asgi_application() }) and these…
th3plus
  • 161
  • 2
  • 11
2
votes
1 answer

Python, fastAPI, uvicorn - Error loading ASGI app. Could not import module "main"

I am having trouble with getting uvicorn to start. I am very new to python and fastapi so I am assuming I have doing something very silly. I have isolated the problem to being in my api_router.py file from fastapi import APIRouter from API.endpoints…
Greg
  • 35
  • 1
  • 2
  • 6
2
votes
1 answer

Does Uvicorn support Stats Server Mechanism?

I am working on a FastAPI web application and using Uvicorn ASGI server. Now, want to configure server stats in Uvicorn but have not found a reference regarding. Ex - As like uWSGI Stats Server provides stats - uwsgi --socket :3031 --stats :1717…
Suyog Shimpi
  • 706
  • 1
  • 8
  • 16
2
votes
1 answer

Django // Daphne 500 error on all requests after version update "TypeError: object HttpResponse can't be used in 'await' expression"

I have a problem where I'm getting 500 responses after updating Django from version 3.1.13 to 3.2.8. The issue wasn't occurring on the previous version of Django, and it only occurs if both the Django Channels app and OpenCensus middleware are…
Oscar Hermoso
  • 302
  • 2
  • 12
2
votes
3 answers

Uvicorn log the errror message instead of INFO:uvicorn.error:Application

I am trying out uvicorn and whenever the server is run, it says INFO:uvicorn.error:Application. How can I see what is causing the error? How do I print the error in the log? » uvicorn serve:app --reload --log-level debug INFO: Uvicorn running on…
user5170375
2
votes
1 answer

Django Channels Private Chat server

I am new to Django channels and the ASGI application itself, so I am a bit confused about how to go while building a private chatting app. There isn't much tutorial for private chats all are for chat rooms and broadcasting I have few thoughts in…
wetler
  • 374
  • 2
  • 11
2
votes
1 answer

How are messaging apps like Whatsapp or Messenger built?

I'm trying to build a mobile messaging app like Whatsapp and don't know where to start. In the first place, I don't know how messaging apps send messages between users. What type of protocol do they use? Do they use websockets? Do they use some sort…
2
votes
0 answers

Unable to run async functions after migrating from WSGI to ASGI in Django Rest Framework

While implementing channels feature in DRF I migrated from WSGI to ASGI. So currently I have REST API and channels in same project->same app. Channels are working and existing APIs as well except ones with async def in it Im getting error below…
NotABot
  • 781
  • 7
  • 24
2
votes
0 answers

Deploy django with apache, django channels 3 and daphne in wss

Os Ubuntu 20 LTS i have a problem with my project in production, and i don't understand where and whats it's going wrong, thease are the files and the responses: 000-default.conf: ..... RewriteEngine on RewriteCond…
2
votes
1 answer

Can a module import of a pex from pantsbuild be exposed?

Cross-post from https://github.com/pantsbuild/pex/issues/1181 as I didn't really know where to ask this. I'm using Nginx Unit, which has an ASGI configuration for my FastAPI application. It's working fine, but I have no clue how to use it with a…
SJoshi
  • 1,866
  • 24
  • 47
2
votes
2 answers

Running FastAPI under IIS

currently I have a simple API running with Flask under a subdirectory of some internal IIS site. Now I thought it might be some idea to rewrite that API using FastAPI instead. Running the API on IIS isn't a hard thing, you have to create a…
brillenheini
  • 793
  • 7
  • 22
2
votes
2 answers

On a machine running Sophos, why do all my browsers fail to receive server sent events (sse) from my Python apps in realtime?

My ASGI app sends events fine to curl, and to my phone. However, even though the server is sending the events, and the headers look right, neither Firefox nor Chrome on my Windows machine receives the events until the connection is closed. This…
jdbow75
  • 497
  • 3
  • 9