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

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -