标签:默认 out == imp logout login for return methods
from flask import Flask, url_for
app = Flask(__name__)
endpoint:用来给url起别名,通过url_for来反向生成url,如果不写则默认是函数名
@app.route(‘/index‘, methods=[‘GET‘, ‘POST‘], endpoint=‘n1‘)
def index():
v1 = url_for(‘n1‘)
v2 = url_for(‘login‘)
v3 = url_for(‘logout‘)
print(v1, v2, v3)
return "index"
@app.route(‘/login‘, methods=[‘GET‘, ‘POST‘])
def login():
return "login"
@app.route(‘/logout‘, methods=[‘GET‘, ‘POST‘])
def logout():
return "logout"
if __name__ == ‘__main__‘:
标签:默认 out == imp logout login for return methods
原文地址:https://www.cnblogs.com/fudong-base/p/14071525.html