-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathserve.py
More file actions
31 lines (25 loc) · 822 Bytes
/
serve.py
File metadata and controls
31 lines (25 loc) · 822 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
import os
import cherrypy
from cherrypy.lib.static import serve_file
class Site(object):
@cherrypy.expose
def index(self):
return serve_file(os.path.join(os.getcwd(), 'index.html'))
@classmethod
def run(cls):
config = {
'/images': {
'tools.staticdir.on': True,
'tools.staticdir.dir': os.path.join(os.getcwd(), 'images'),
},
'/js': {
'tools.staticdir.on': True,
'tools.staticdir.dir': os.path.join(os.getcwd(), 'js'),
},
'/css': {
'tools.staticdir.on': True,
'tools.staticdir.dir': os.path.join(os.getcwd(), 'css'),
},
}
cherrypy.quickstart(cls(), config=config)
__name__ == "__main__" and Site.run()