2

I'm having problems understanding how I would use Google App Engine URL handler mapping to map URLs to various files. Here's the code I currently have:

app.yaml

handlers:
- url: /
script: main.app
- url: /blog/*
  script: blog.app

end of main.py (MainPage handler does exist towards top)

app = webapp2.WSGIApplication([('/', MainPage)], debug=True)

end of blog.py (BlogPage and New Post exist towards top)

app = webapp2.WSGIApplication([('/blog', BlogPage), ('/blog/newpost', NewPost)], debug=True)

So right now, if I go to http://127.0.0.1/ my MainPage handler will pick it up like it's supposed to. But, if I go to http://127.0.0.1/blog/ then I end up getting a 404. I can't figure out if it's the handler in my blog.py file that's messing up, or if I need to have the handlers defined in app.yaml changed.

Thanks much!

1 Answer 1

4

There was no match for the URI you're requesting, i.e. /blob/. Note that you have the extra '/' at the end. If you want that to be handled by BlogPage, you can use the following ...

app = webapp2.WSGIApplication([('/blog/?', BlogPage), ('/blog/newpost', NewPost)], debug=True)

/blog/? will match either /blog or /blog/.

Hope that helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.