pip install karrigell python from karrigell import * def index(): return "Hello, World!" add_url('/', index) application.run() python from karrigell import * def greet(name): return f"Hello, {name}!" add_url('/greet/(?P<name>\w+)/$', greet) application.run() python from karrigell import * from karrigell_core import render_template def index(): name = "John" return render_template("index.html", name=name) add_url('/', index) application.run() python from karrigell import * from karrigell_core import render_template def login(): if request.method == "POST": username = request.form.get("username") password = request.form.get("password") return f"Hello, {username}!" return render_template("login.html") add_url('/login', login) application.run()


上一篇:
下一篇:
切换中文