标签:def run imp port from div 开始 flask 访问
# python 3.7 from flask import Flask, url_for app = Flask(__name__) print(app,‘这里是app‘) @app.route(‘/index‘) def index(): return ‘<h1>这里是首页</h1>‘ @app.route(‘/admin/login/form/show/<name>‘) def show(name): return ‘参数值为:%s‘%name @app.route(‘/url‘) def url():####此处用于反向解析 # 通过index()解析出对应的访问路径,,此处开始进行反向解析 url_index= url_for(‘index‘) url_show= url_for(‘show‘,name=‘liu‘) print(url_show) return ‘<a href="%s">wee</a>‘%url_show if __name__ == ‘__main__‘: app.run(debug=True)
标签:def run imp port from div 开始 flask 访问
原文地址:https://www.cnblogs.com/Skyda/p/9857728.html