-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
57 lines (43 loc) · 1.37 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
import os
import urllib2
import jinja2
import webapp2
from handlers import cookies
from handlers import recommender
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'],
autoescape=True
)
class MainHandler(webapp2.RequestHandler):
""" About page
"""
def get(self):
template = JINJA_ENVIRONMENT.get_template('templates/index2.html')
self.response.write(template.render())
class ScHandler(webapp2.RequestHandler):
""" Main page where user inputs artist, gets recommendations back.
"""
def get(self):
template = JINJA_ENVIRONMENT.get_template('templates/sc-index.html')
self.response.write(template.render())
class CubesHandler(webapp2.RequestHandler):
""" Render cubes
"""
def get(self):
template = JINJA_ENVIRONMENT.get_template('templates/cubes.html')
self.response.write(template.render())
class ProcHandler(webapp2.RequestHandler):
""" Render processing sketch
"""
def get(self):
template = JINJA_ENVIRONMENT.get_template('templates/processing.html')
self.response.write(template.render())
app = webapp2.WSGIApplication([
('/', MainHandler),
('/sc', ScHandler),
('/recommender/(\w+)', recommender.RecommendationHandler),
('/cubes', CubesHandler),
('/processing', ProcHandler),
('/cookies', cookies.CookiesHandler)
], debug=True)