python - Why is my HTML page not being displayed on the local host in Google App Engine? -


here's main.py file , html file want rendered jinja2 template using:

main.py

import os import webapp2 import jinja2 google.appengine.ext import db  template_dir = os.path.join(os.path.dirname(__file__), 'templates') jinja_env = jinja2.environment(loader = jinja2.filesystemloader(template_dir),     autoescape=true)  class handler(webapp2.requesthandler):     def write(self, *a, **kw):         self.response.out.write(*a, **kw)     def render_str(self, template, **params):         t = jinja_env.get_template(template)         return t.render(params)     def render(self, template, **kw):         self.write(self.render_str(template, **kw))  class mainpage(handler):     def get(self):         self.render("temp.html")  app = webapp2.wsgiapplication([('/', mainpage)], debug=true) 

temp.html

<!doctype html> <html> <head> <style> div#logo {  position: absolute;  margin-top:5%;  margin-left:25%; }  div#cart {  position: absolute;  margin-left:87%;  margin-top:-2px;  } </style> </head>  <body> <div id = logo><img src="logo.png" height = 60% width = 60%></div> <div id = cart><img src="cart.jpg" height = 75 px ></div> </body> </html> 

now, have saved html file along required images in templates folder of app engine application directory. also, html file works fine when run on browser. however, when run application using gae, blank screen get. why so? why html file not getting rendered?

some suggestions:

  1. check html rendering (put text in html file)
  2. your app.yaml file needs include static dir photos placed. see https://github.com/googlecloudplatform/appengine-guestbook-python/blob/master/app.yaml example.
  3. reference images using url appropriate put images, e.g. if put them under "client" directory.

https://github.com/googlecloudplatform/appengine-guestbook-python

is @ basic configuration.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

java.util.scanner - How to read and add only numbers to array from a text file -

iphone - Three second countdown in cocos2d -