我无法about_me从index页面转到页面。错误 :
在服务器上找不到请求的 URL。
并得到像"http://127.0.0.1:5000/%7B%7B%20url_for('about')%20%7D%7D".
from flask import Flask, redirect, url_for
app = Flask(__name__)
@app.route('/')
def index():
return '''
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
</head>
<body>
<p>welcome home</p>
<a href="{{ url_for('about_me') }}">about</a>
</body>
</html>
'''
@app.route('/about')
def about_me():
return 'about me'
if __name__ == '__main__':
app.run(debug=True)
ibeautiful
相关分类