# Python Workers now runs Django and Flask right out of the box!

Hi everyone, it's me! I found some news that Python fans are going to love — let's dive in!

## What was announced?

According to the Cloudflare Changelog, Python Workers now support Python web frameworks that follow the WSGI (Web Server Gateway Interface) or ASGI (Asynchronous Server Gateway Interface) spec. That means frameworks you already know — Django and Flask (WSGI), or FastAPI and Starlette (ASGI) — can now run as-is.

## The story so far

Python Workers already existed, but bringing a standard framework like Django or Flask into it wasn't straightforward. Now that the `workers` module ships `wsgi` and `asgi`, you can bring over the coding style you already know almost unchanged.

## What changes

For WSGI frameworks (Django, Flask), you just import `wsgi` from the `workers` module and pass your app to `wsgi.entrypoint()`.

```python
from workers import wsgi
from django.core.wsgi import get_wsgi_application

app = get_wsgi_application()
Default = wsgi.entrypoint(app)
```

For ASGI frameworks (FastAPI, Starlette), you use `asgi` the same way.

```python
from workers import asgi
from fastapi import FastAPI

app = FastAPI()
Default = asgi.entrypoint(app)
```

It's great that a Django or FastAPI app can now run on Cloudflare's edge with just a few lines of code.

## Dive Deep

`wsgi.entrypoint()` is essentially equivalent to creating a `WorkerEntrypoint` class and calling the `wsgi.fetch` method internally. If you want finer control — say, to add request preprocessing — you can extend `WorkerEntrypoint` directly instead.

```python
from workers import wsgi, WorkerEntrypoint

class Default(WorkerEntrypoint):
    async def fetch(self, request):
        return await wsgi.fetch(app, request, self.env)
```

Supported frameworks so far:

- WSGI: Django, Flask
- ASGI: FastAPI, Starlette

For details on using individual frameworks, check the official Python Workers package documentation.

## Wrap-up

- Python Workers now supports WSGI/ASGI-compliant frameworks
- WSGI frameworks (Django, Flask) run via `wsgi.entrypoint()`
- ASGI frameworks (FastAPI, Starlette) run via `asgi.entrypoint()`
- You can extend `WorkerEntrypoint` directly for finer control

If you're a Python developer comfortable with Django, Flask, or FastAPI and want to deploy to the edge without changing how you write code, this update is for you!
