-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
35 lines (27 loc) · 983 Bytes
/
app.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
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp.util import run_wsgi_app
import logging
import os
import random
import webapp2
if 'SERVER_SOFTWARE' in os.environ:
PROD = not os.environ['SERVER_SOFTWARE'].startswith('Development')
else:
PROD = True
class BaseHandler(webapp2.RequestHandler):
def render_template(self, f, template_args):
path = os.path.join(os.path.dirname(__file__), "templates", f)
self.response.out.write(template.render(path, template_args))
def push_html(self, f):
path = os.path.join(os.path.dirname(__file__), "html", f)
self.response.out.write(open(path, 'r').read())
class ChangeTool(BaseHandler):
def get(self):
self.render_template('change-tool-template.html', {})
application = webapp2.WSGIApplication(
[('/', ChangeTool), ('/.*',ChangeTool)],
debug=True)
def main():
run_wsgi_app(application)
if __name__ == "__main__":
main()