python - url_for in flask template all point to 404 page?
漂亮男人
漂亮男人 2017-05-18 10:46:08
0
1
600

The links using url_for in the template all point to the 404 page, such as:

<li><a href="{{ url_for('auth.logout') }}">登出</a></li>

Click the logout button to go to the 404 page

But if I use 127.0.0.1:5000/logout, I can log out

The results of url_for in the template file are None, so when clicking any link the URL becomes 127.0.0.1:5000/None. If such a route is added:

@main.route("/None")
def test():
    return "None"

Click on any link to jump to test

漂亮男人
漂亮男人

reply all(1)
大家讲道理

Since you set all routes to /None, naturally only the view function corresponding to this route will be skipped, which is the test.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template