nginx - How to rewrite the url in tornado -


i'm learning tornado , nginx these days,and i'm confused url rewrite.

for example:if wanna make url this

www.abc.com/username/projectname ( username , projectname depend on user )

i got 2 solution,first 1 use regular expressions like

(r'/(w+)/(w+)', indexhandler)

and trying username , projectname url , search in database

second solution use nginx rewrite this

www.abc.com/username/projectname => abc.domian.com/?us=username&pj=projectname

which solution correct? lot.

both correct. in case, personally, use first form tornado server can work whether nginx present or not (more convenient development , testing), there times when simpler rewrites @ nginx level.


Comments