Files
microdot/examples/hello/hello_jinja.py
2022-08-14 16:35:17 +01:00

18 lines
386 B
Python

from microdot import Microdot, Response
from microdot_jinja import render_template
app = Microdot()
Response.default_content_type = 'text/html'
@app.route('/', methods=['GET', 'POST'])
def index(req):
name = None
if req.method == 'POST':
name = req.form.get('name')
return render_template('index_jinja.html', name=name)
if __name__ == '__main__':
app.run()