-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev_server.py
More file actions
executable file
·42 lines (35 loc) · 929 Bytes
/
dev_server.py
File metadata and controls
executable file
·42 lines (35 loc) · 929 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""
Cherrypy development server for Door
Launches on port 8000 and listens on 0.0.0.0
"""
import cherrypy
import sys
import os
### Bring mulch into the system path
# get path of parent directory (containing mulch)
path = os.path.dirname(os.path.abspath(__file__))
# used later in the program, ignore for now
door_path = os.path.join(path, 'door')
if not path in sys.path:
sys.path.append(path)
### update the cherrypy global config
cherrypy.config.update({
'server.socket_host': '0.0.0.0',
'server.socket_port': 8000
})
# cherrypy.config.update(os.path.join(door_path, 'config.cfg'))
### create a new config to serve the static files
add_staticdir_conf = {
'/': {
'tools.staticdir.root':door_path
},
'/static': {
'tools.staticdir.on':True,
'tools.staticdir.dir':'static'
}
}
### mount and start the app
import door
app = cherrypy.tree.mount(door, '/')
app.merge(add_staticdir_conf)
cherrypy.quickstart(app)