pip install Karrigell python from Karrigell import ws @ws.url('/hello') def hello(req, out): out.write('Hello, Karrigell!') ws.serve() python from Karrigell import ws ws.TEMPLATE_DIR = 'templates' ws.STATIC_DIR = 'static' @ws.url('/hello') def hello(req, out): template = ws.template('hello.html') out.write(template.render()) ws.serve() python from Karrigell import ws @ws.url('/form') def form(req, out): if req.method == 'GET': template = ws.template('form.html') out.write(template.render()) elif req.method == 'POST': name = req.form['name'] out.write(f'Hello, {name}!') ws.serve()


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