-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathapp.py
More file actions
28 lines (19 loc) · 739 Bytes
/
Copy pathapp.py
File metadata and controls
28 lines (19 loc) · 739 Bytes
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
import os
import cherrypy
from jinja2 import Environment, FileSystemLoader
ENV = Environment(loader=FileSystemLoader('templates'))
def get_params():
params = {'key': os.environ.get('key', ''),
'user': os.environ.get('user', ''),
'password': os.environ.get('password', '')}
return params
class Root(object):
@cherrypy.expose
def index(self):
tmpl = ENV.get_template('index.html')
params = get_params()
return tmpl.render(params)
cherrypy.config.update({'server.socket_host': '0.0.0.0',
'server.socket_port': int(os.environ.get('PORT',
'8055'))})
cherrypy.quickstart(Root())