python - Flask Custom Routing -
say i'm defining user profile page in flask:
@app.route('/user/<name>') def user(name): stuff
i'd change routing rules can put more 1 designation in <name>
, e.g. <name, location>
translate user name , location, url given /user/james-oregon.
if understand correctly, you're looking for...
@app.route('/user/<name>-<location>') def user(name, location): # stuff...
when using url /user/james-oregon
, should "james" name
, "oregon" location
.
note flask largely built off of werkzeug, sure check out werkzeug routing documentation well.
Comments
Post a Comment