Hello NP, That code works for me running on the development server on Windows 7 running Chrome 23.
You haven't included your app.yaml, so I used *handlers:* * * *- url: /.** * script: main.py * Is that what you have? Regards, Julie On 16 January 2013 08:17, NP <[email protected]> wrote: > I'm trying to implement url slugs in my app (python-based). I want the > slugged URL to be of the format myhost/<post_id>/<post_title> > > When I try to access the page using the above slugged url format, I get an > error and (in Chrome, the error says - unexpected token <). If I delete the > '/<post_title>' from the url, the page loads correctly. Specifically, I > noticed that once I have a 'forward slash' after the <post_id>, I have > issues. Everything works fine without that extra slash (extra directory) > > My code is > > class mainhandler(webapp.RequestHandler): > def get(self): > if (self.request.path == '/test'): > path = os.path.join (os.path.dirname (__file__), 'test.htm') > self.response.headers ['Content-Type'] = 'text/html' > self.response.out.write (template.render (path, {})) > else: > path = os.path.join (os.path.dirname (__file__), 'index.htm') > > self.response.headers ['Content-Type'] = 'text/html' > > self.response.out.write (template.render (path, {})) > > application = webapp.WSGIApplication( [('/.*', mainhandler)], debug=True) > > Basically, I want to load the index.htm file and on that file, I have > javascript which is supposed to extract the post-id from the URL and do > some stuff with it. > > Anybody know what I'm doing wrong here? > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/google-appengine/-/YesSG15kKXYJ. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
