Reputation: 119
Definitely a beginner question... basically, I want to have the same design from this website. I understand the HTML part, but the problem is that I am not completely sure how to actually render multiple html files in one view.
http://www.htmliseasy.com/frames_tutor/templates/template1.html
My webpage is in this linkk. http://everyology.appspot.com/biology
What I am using is Google app engine. Here is a partial code that is relevant to the question. My concern is with class BioPage... I wrote these and am seeing the frames but getting 404 errors in my webpage.
import os
import webapp2
from string import letters
import jinja2
template_dir = os.path.join(os.path.dirname(__file__), 'templates')
jinja_env = jinja2.Environment(loader = jinja2.FileSystemLoader(template_dir),
autoescape = True)
def render_str(template, **params):
t = jinja_env.get_template(template)
return t.render(params)
class MainHandler(webapp2.RequestHandler):
def write(self, *a, **kw):
self.response.out.write(*a, **kw)
def render_str(self, template, **params):
return render_str(template, **params)
def render(self, template, **kw):
self.write(self.render_str(template, **kw))
class MainPage(MainHandler):
def get(self):
self.render('index.html')
class BioPage(MainHandler):
def get(self):
self.render('biology.html')
self.render('doc1.html')
self.render('doc2.html')
Upvotes: 0
Views: 315
Reputation: 24966
The problem you're running in to is how <frame>
tags operate. To fill in frames, browsers make an additional request per frame. Your code is trying to guess ahead, shipping all of the frame contents back in one clump. That's not how it works. You're going to need separate handlers for each of your frames, in addition to the main page. Alternatively, those pages that are completely static can be served static pages.
Upvotes: 1