Views
Standard Django views - add routing with decorators
from nanodjango import Django
app = Django()
@app.path("/")
def home(request):
return "Hello world!"
Models
Define database models using standard Django syntax
Register them with the admin site using @app.admin
from django.db import models
@app.admin
class Post(models.Model):
title = models.CharField(max_length=100)
content = models.TextField()
Templates
Define templates in a dict (or a templates dir)
Render them manually, or using the app.render helper
@app.path("/posts/")
def posts(request):
return app.render(
"posts.html",
{"posts": Post.objects.all()},
)
app.templates = {
"posts.html": "..."
}
APIs
Built-in support for APIs, using Django Ninja
@app.api.get("/posts/")
def list_posts(request):
return [{"id": 1, "title": "Hello"}]
@app.api.post("/posts/")
def create_post(request, post: PostSchema):
return {"created": True}
Async
Use Django's async support
import asyncio
@app.route("/async/")
async def async_view(request):
await asyncio.sleep(2)
return "I slept for 2 seconds"
@app.api.get("/async-api/")
async def async_api(request):
await asyncio.sleep(2)
return {"message": "I slept for 2 seconds"}
Use it, share it, grow it
Run locally
Get started quickly with minimal setup
# Directly when installed
nanodjango run myapp.py
# With uv and inline dependencies
uv run myapp.py
Share a live browser app
Share your app instantly with others
Embed your live app in your site using an iframe
Coming soon!
# Share it on the nanodjango.dev playground
nanodjango share myapp.py
Run it on a server
Deploy to any hosting provider
# Serve manually on your server
nanodjango serve myapp.py
# Deploy with django-simple-deploy
nanodjango deploy myapp.py
Convert to full Django
Transform your single file into a complete Django project structure
# Convert with one command
nanodjango convert myapp.py myproject
Videos
5 Minute Introduction
Lightning talk, DjangoCon US 2024
5 Minute Recap and Update
Lightning talk, DjangoCon US 2025
25 Minute Deep Dive
"Prototypes Sharing and Services Full Django in a Single File", PyCon UK 2025