Import the Flask Flask from, the render_template, Request, the redirect, jsonify, views, the url_for, Markup
from werkzeug.routing Import BaseConverter
# regular expression matching parameters required to complete
App = the Flask (IMPORT_NAME = __ name__)
# = app.secret_key 'sdfsdfsdfsdf', session set value
#Markup write the code may be the front end of the rear end to the front end of language rendering
the USERS = {
. 1: { 'name': 'John Doe', 'age': 18, 'gender': ' M', 'text' : "road ten million"},
2: { 'name': 'John Doe', 'age': 28, 'gender': ' M', 'text': "safety first"},
3: { 'name': 'Wang Wu', 'age': 18, 'gender': ' M', 'text': "road irregularities"},
}
DEF func1 (ST, ST1):
return Markup (F "<h1 of > jsaon GDX-ST} {} {ST1 </ h1 of> ")
@app.route('/list',methods=['GET'])
def list():
info=USERS
return render_template('list.html',info=info,html="<h1>jsaon-gdx</h1>",html1=func1)
@app.route('/detail/<int:nid>',methods=['GET'],endpoint="sb")
def detail(nid):
return "ok"
if __name__ == '__main__':
app.run()
How to write the front end of the back-end code is set in the session flask
Guess you like
Origin www.cnblogs.com/yangxinpython/p/11845545.html
Recommended
Ranking