Question

For a blog project, I'm trying to set different webapp2 handlers for different urls. One of them is the "permalink" url of a post (accessed by post id). Another one is the url for deleting said post. When I try to go to such url, I get a blank page, and the AppEngineLauncher console says:

INFO    2014-01-20 08:08:42,574 module.py:612] default: "GET /del/5066549580791808 HTTP/1.1" 404 -

This is the code for the handlers part of my program:

application = webapp2.WSGIApplication([ ('/newpost', NewPost),     #works OK
                                        ('/([0-9]+)', PermaLink),  #works OK 
                                        ('/del/([0-9]+)', Delete), #won't work!!!
                                        ('/', Front)], debug=True) #works OK

If somebody has some clue about this I'd appreciate it. I've been looking for a solution but the fact that I get no error message and it doesn't seem (to me at least) to make any sense makes it so much harder.

EDIT: The app.yaml file:

application: blogapp
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /.*
  static_dir: static

- url: /.*
  script: base.application

libraries:
- name: jinja2
  version: latest

The Delete class is trivial code for testing, such as:

class Delete(Base):  #Base is my base RequestHandler
    def get(self, s):
        self.response.write(s)

I even tried matching the urls '/del/([0-9]+)' to the same PermaLink class, and still doesn't work.

Was it helpful?

Solution

Nevermind, it's solved. I tidied up the yaml file and everything works correctly now.

application: blogapp
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /static
  static_dir: static

- url: (/.*)*
  script: base.application

libraries:
- name: jinja2
  version: latest
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top