The following problem has bothered me for a long time. Can anybody help?
Thanks
The "main.html" file is in the "templates" directory under the app root
directory.
Google App Engine keeps complaining that it cannot find "main.html".
app.yaml:
---------------------------
application: templateTest
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
script: main.py
---------------------------
main.py:
---------------------------
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
import os
from google.appengine.ext.webapp import template
class MainPage(webapp.RequestHandler):
def get(self):
path = os.path.join(os.path.dirname(__file__),
"templates/main.html")
self.response.out.write(template.render(path, {}))
application = webapp.WSGIApplication([("/", MainPage)], debug=True)
def main():
run_wsgi_app(application)
if __name__ == "__main__":
main()
---------------------------
The error message:
.../google_appengine/lib/django_1_2/django/template/loader.py", line 138, in
find_template
raise TemplateDoesNotExist(name)
TemplateDoesNotExist: main.html
--
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/-/ncK-eBY0jKgJ.
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.