-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.py
35 lines (31 loc) · 984 Bytes
/
server.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
import random
import string
import os,os.path
import cherrypy
from hal import set_angle
from hal import sequence
class WebPage(object):
@cherrypy.expose
def index(self):
return open(os.path.join('./public/index.html'))
@cherrypy.expose
def generate(self, length=8, cocktail='whiskycoca'):
sequence()
return open(os.path.join('./public/done.html'))
#return 'Cocktail ',cocktail,' is Coming'
#''.join(random.sample(string.hexdigits, int(length)))
if __name__ == '__main__':
conf = {
'/': {
'tools.sessions.on': True,
'tools.staticdir.root': os.path.abspath(os.getcwd())
},
'/static': {
'tools.staticdir.on': True,
'tools.staticdir.dir': './public'
}
}
cherrypy.config.update({'server.socket_port': 8090,
'server.socket_host':'0.0.0.0',
'engine.autoreload_on': False})
cherrypy.quickstart(WebPage(), '/', conf)