Created
January 13, 2015 04:43
-
-
Save shakna-israel/1c9cd87fa77970d4c52c to your computer and use it in GitHub Desktop.
CherrPy QuickServe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cherrypy | |
import os.path | |
current_dir = os.path.dirname(os.path.abspath(__file__)) | |
class RootPage: | |
def index(self): | |
raise cherrypy.HTTPRedirect("/static/index.html") | |
def getMachineInfo(self): | |
return "hello" | |
index.exposed = True | |
getMachineInfo.exposed = True | |
if __name__ == '__main__': | |
conf = { | |
'global': { | |
'server.socket_host': '0.0.0.0', | |
'server.socket_port': 8080, | |
'server.threaed_pool': 50 | |
}, | |
'/': { | |
'tools.staticdir.root': current_dir | |
}, | |
'/static': { | |
'tools.staticdir.on': True, | |
'tools.staticdir.dir': 'static' | |
} | |
} | |
cherrypy.quickstart(RootPage(), config=conf) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment