Can't route to "/login" with flask?
Please read the flask quickstart Unique URLs / Redirection Behavior, URL canonicalization and Trailing slash in URLs - which style is preferred?
EDIT
You could turn off the strict url mode in the route module, to get the /login/
request working
Add the following code after you app = Flask(__name__)
and before you define any routing.
app.url_map.strict_slashes = False
Original Answer
My chrome is messing the request somehow. I open the <F12>
developer tools and find that it automatically redirect my /login
request to /login/
.
GeneralRequest URL:http://roxma.org:8000/helloRequest Method:GETStatus Code:301 MOVED PERMANENTLY (from disk cache)Remote Address:127.0.0.1:1080RequestContent-Length:263Content-Type:text/html; charset=utf-8Date:Wed, 28 Dec 2016 14:24:44 GMTLocation:http://roxma.org:8000/hello/Server:Werkzeug/0.11.11 Python/3.5.1
This is awkward. I don't know how to fix this issue. I guess the best solution is to use /login/
style instead.