hero

Bocadillo

A modern Python web framework filled with asynchronous salsa

Get Started →

Simple and productive

A minimal setup and carefully chosen included batteries help you solve common (and more advanced) problems in no time.

Async-first

Embrace modern Python asynchronous programming capabilities! Don't worry, though — it's all optional.

Performant

Built on Starlette and Uvicorn, the lightning-fast Python ASGI toolkit and server.

Quick start

Install it:

pip install bocadillo

Build something:

# api.py
import bocadillo

api = bocadillo.API()

@api.route("/")
async def index(req, res):
    # Use a template from the ./templates directory
    res.html = await api.template("index.html")

@api.route("/greet/{person}")
async def greet(req, res, person):
    res.media = {"message": f"Hi, {person}!"}

if __name__ == "__main__":
    api.run()

Launch:

python api.py

Make requests!

curl http://localhost:8000/greet/Bocadillo
{"message": "Hi, Bocadillo!"}

Hungry for more? Head to our Getting Started guide!