Oops!

Of course the code under "def get(self):"  should be indented
accordingly.




= = = = = = = = = =

How about this (assumes you have the "helloworld.html" stored in the
"templates" subfolder of where your code is)

for main.py:

from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp import template

class MainHandler(webapp.RequestHandler):
    def get(self):
    template_values = { 'textMessage': 'Hello World', }
    path = os.path.join(os.path.dirname(__file__), 'templates/
helloworld.html')
    self.response.out.write(template.render(path, template_values))

def main():
    application = webapp.WSGIApplication([('/', MainHandler)],
                                         debug=True)
    util.run_wsgi_app(application)

if __name__ == '__main__':
    main()



for helloworld.html:


<html>
  <head>
    <title>My Template</title>
  </head>

  <body>
    <p> {{textMessage}}  </p>
  </body>
</html>

-- 
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.

Reply via email to