code_junkie

AppEngine and Django: including a template file

Nov 13th, 2011
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. TEMPLATE_DIRS = (os.path.join(os.path.dirname(__file__), 'templates'), )
  2.  
  3. directory, file_name = os.path.split(abspath)
  4. new_settings = {
  5. 'TEMPLATE_DIRS': (directory,),
  6. 'TEMPLATE_DEBUG': debug,
  7. 'DEBUG': debug,
  8. }
  9.  
  10. def render(file, map={}):
  11. return template.render(
  12. os.path.join(os.path.dirname(__file__), '../templates', file), map)
  13.  
  14. table = render("table.html", {"headers": headers, "rows": rows})
  15. final = render("final.html", {"table": table})
  16.  
  17. self.response.out.write(final)
Add Comment
Please, Sign In to add comment