开发者

setting url in yaml file for google app engin (page not found) problem

I am new to python and I am super excited to learn. I am building my first app on app engin and I am not totally understanding why my yaml file is not resolving to the url that I set up.

here is the code

handlers:
- url: .*
  script: main.py

- url: /letmein/.*
  script: letmein.py 

so if I go to http://localhost:8080/letmein/ I get a link is brooken or page not found error.

here is the python code that I have in letmein.py

from google.appengine.ext import webapp
from google.appengine.ext.webapp import util


class LetMeInHandler(webapp.RequestHandler):
    def ge开发者_开发知识库t(self):
        self.response.out.write('letmein!')


def main():
    application = webapp.WSGIApplication([('/letmein/', LetMeInHandler)],
                                         debug=True)
    util.run_wsgi_app(application)


if __name__ == '__main__':
    main()

thanks in advance for the help!


Your handlers are in the wrong order as they must always be less general first. Change to:

handlers:
- url: /letmein/.*
  script: letmein.py

- url: .*
  script: main.py

and it works.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜