Pages are files
Add a directory with a page.py under routes/
and it answers a URL. Bracketed segments capture typed parameters.
- Directories become URL segments, no
urls.py -
[int:post_id]captures a typed path parameter -
DUrl[int]coerces and injects it by type
from notes.models import Note from next.pages import context from next.urls import DUrl @context("note") def note(post_id: DUrl[int]) -> Note: return Note.objects.get(pk=post_id)