Drafter
Drafter turns the Python you already know into real, interactive
websites. Write plain functions, decorate them with @route, and Drafter
serves the pages they return as a website you can click through, test, and
publish for free.
from drafter import *
from dataclasses import dataclass
@dataclass
class State:
clicks: int
@route
def index(state: State) -> Page:
return Page(state, [
"You have clicked " + str(state.clicks) + " times.\n",
Button("Click me!", "add_click"),
])
@route
def add_click(state: State) -> Page:
state.clicks = state.clicks + 1
return index(state)
start_server(State(0))
That is a complete Drafter program. Try clicking the button above, then change the code and run it again.