I am currently making a very basic website for my web design class using python, html, and google app engine. I am able to make the website using multiple handlers, but we are supposed to make a multi page site using only 1 handler.
I can get handlers such as:
class IndexHandler(webapp2.RequestHandler):
def get(self):
template = JINJA_ENVIRONMENT.get_template('templates/index.html'))
self.response.write(template.render({'title': 'HOME', 'header':'HOME'}))
class FriendHandler(webapp2.RequestHandler):
def get(self):
template = JINJA_ENVIRONMENT.get_template('templates/friends.html')
self.response.write(template.render({'title': "FRIENDS", 'header': "FRIENDS"}))
to work, but when I try to combine them using:
class AllTheHandlers(webapp2.RequestHandler):
def get(self):
template = JINJA_ENVIRONMENT.get_template('templates%s' % self.request.path)
self.response.write(template.render({'title', 'header'}))
outstr = template.render(temp, { })
self.response.out.write(outstr)
I get a 404 error, and my log says:
INFO 2016-02-06 06:14:13,445 module.py:787] default: "GET / HTTP/1.1" 404 154
any help would be very much appreciated, even just pointers on how to use the self.request.path attribute would be helpful I think. I feel like part of my issue has to do with the end of my code but I'm not sure:
app = webapp2.WSGIApplication([
('/', AllTheHandlers),
# ('/bio.html', AllTheHandlers),
# ('/index.html', AllTheHandlers),
# ('/friends.html', AllTheHandlers),
# ('/horses.html', AllTheHandlers),
], debug=True)
thanks for any help you can provide!