September 2, 2026
Python web frameworks following the Web Server Gateway Interface (WSGI) or Asynchronous Server Gateway Interface (ASGI) specification can now be used in Python Workers.
For WSGI frameworks like Django or Flask:
from workers import wsgi
from django.core.wsgi import get_wsgi_application
app = get_wsgi_application()
Default = wsgi.entrypoint(app)For ASGI frameworks like FastAPI or Starlette:
from workers import asgi
from fastapi import FastAPI
app = FastAPI()
Default = asgi.entrypoint(app)The wsgi.entrypoint is equivalent to creating a WorkerEntrypoint class and using the wsgi.fetch method. For more control over the WorkerEntrypoint class, developers can use wsgi.fetch directly within a custom entrypoint class.