Skip to content

Instantly share code, notes, and snippets.

@shakna-israel
Created January 13, 2015 04:43
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save shakna-israel/1c9cd87fa77970d4c52c to your computer and use it in GitHub Desktop.
CherrPy QuickServe
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