Simple Python App Engine Server with Directory Routing -
i'm new app engine , python. i've gone through tutorials, haven't been able find simple/elegant solution i'm looking for.
i want make website has multiple directories:
/home /index.html /stuff /index.html /otherstuff /index.html i know can if in app.yaml file do:
- url: /otherstuff script: account/otherstuff.py - url: /stuff script: game/stuff.py - url: .* script: home.py my problem is not elegant solution since have 3 python files serve simple html files. instead hoping have 1 python file routes requests appropriate directory. since i'm such newb app engine , python - hoping willing shed light on how this.
thanks much!
as don't have enough reputation point comment, i'm using answer answer robbie's follow question (which should asked separately). within main.py, specifically, within:
app = webapp2.wsgiapplication( [ ('/', homehandler), ('/stuff/', stuffhandler) ], debug=true ) this section uses regular expressions, , exit upon first match. here nice, albeit brief, primer on regex ... regex in 15 minutes here great documentation on uri routing in webapp2 , finally, there documentation regarding exception handling in aforementioned documentation.
Comments
Post a Comment