-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
61 lines (49 loc) · 1.76 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
50
51
52
53
54
55
56
57
58
59
60
61
import webapp2
import jinja2
import os
jinja_environment = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)+'/templates/style1')
)
TEMPLATE_DIR = 'templates/style1'
class Home(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/html'
tvars = {}
template = jinja_environment.get_template('home.html')
self.response.out.write(template.render(tvars))
class Changes(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/html'
tvars = {}
template = jinja_environment.get_template('changes.html')
self.response.out.write(template.render(tvars))
class Builds(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/html'
tvars = {}
template = jinja_environment.get_template('builds.html')
self.response.out.write(template.render(tvars))
class OpenSource(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/html'
tvars = {}
template = jinja_environment.get_template('opensource.html')
self.response.out.write(template.render(tvars))
class Shapes(webapp2.RequestHandler):
def get(self, name):
self.response.headers['Content-Type'] = 'text/html'
tvars = {}
if name == '':
name = 'shapes'
template = jinja_environment.get_template('%s.html' % name.replace('/', ''))
self.response.out.write(template.render(tvars))
app = webapp2.WSGIApplication(
[
('/', Home),
('/changes/?', Changes),
('/shapes/?(.*)/?', Shapes),
('/open-source/?', OpenSource),
('/builds/?', Builds),
],
debug=True
)