-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
49 lines (39 loc) · 1.56 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python
"""main.py: Handler file to instantiate html templates with jinja."""
__author__ = "Kevin Frew"
__license__ = "GPL"
__version__ = "1.1"
__maintainer__ = "Kevin Frew"
__email__ = "kevin@kevinfrew.com"
import os
import jinja2
import webapp2
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'],
autoescape=True)
class MainPage(webapp2.RequestHandler):
def get(self):
template = JINJA_ENVIRONMENT.get_template('templates/main.html')
self.response.write(template.render({}))
class AboutPage(webapp2.RequestHandler):
def get(self):
template = JINJA_ENVIRONMENT.get_template('templates/about.html')
self.response.write(template.render({}))
class PhotoPage(webapp2.RequestHandler):
def get(self):
template = JINJA_ENVIRONMENT.get_template('templates/photography.html')
self.response.write(template.render({}))
class ResumePage(webapp2.RequestHandler):
def get(self):
template = JINJA_ENVIRONMENT.get_template('templates/resume.html')
self.response.write(template.render({}))
class ContactPage(webapp2.RequestHandler):
def get(self):
template = JINJA_ENVIRONMENT.get_template('templates/contact.html')
self.response.write(template.render({}))
app = webapp2.WSGIApplication([('/', MainPage),
('/about/*', MainPage),
('/photography/*', PhotoPage),
('/resume/*', ResumePage),
('/contact/*', ContactPage)])