I'm using Jinja2 and GAE, and I'm using a helper function to render HTML files. When I try to render a HTML file that is nested within a subdirectory (Gamification), Jinja doesn't seem to be pulling out the CSS and images files. Does anyone know what I should do?
My current YAML structure is as follows
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: .*
script: main.app
libraries:
- name: webapp2
version: "2.5.1"
- name: jinja2
version: latest
My current directory structure is as such.
Main directory
|
-- main.py
|
----Templates
|
--Gamification
|
--index.html
|
--CSS
|
--1.css
|
--img
|
--1.jpef
main.py
jinja_environment = jinja2.Environment(loader=jinja2.FileSystemLoader(['Templates', 'Templates\Gamification']));
def import_html(self, address, val = {}):
template = jinja_environment.get_template(address);
self.write(template.render(val));
The html file in question is as follows:
<!DOCTYPE html>
<html>
<head>
<title>Gamification</title>
<link href="css/bootstrap.css" rel="stylesheet">
</head>
<body>
<img src = "img/dan.jpeg" class = "img-rounded" />
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="js/bootstrap.js"></script>
</body>
</html>