views:

66

answers:

1

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 get(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!

+4  A: 

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.

Alex Martelli