Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
4009cem/hello-cherry-world.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
14 lines (11 sloc)
1002 Bytes
This file contains 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
'''simple Hello World which specifies a remote host and port (not localhost) to make use of codio box''' | |
import cherrypy | |
class HelloWorld(object): | |
@cherrypy.expose #use cherrypy | |
@cherrypy.tools.gzip() #use cherrypy configuration tools | |
def index(self): #method | |
return "Hello 4009CEM-world!" #returns string (will appear in browser) | |
if __name__ == '__main__': | |
cherrypy.config.update({'server.socket_host': '0.0.0.0'}) #configure host (not 127.0.0.1) | |
cherrypy.config.update({'server.socket_port': 3000}) #configure port | |
cherrypy.quickstart(HelloWorld(), '/', {'/': {'tools.gzip.on': True}}) #start application; provide configuration support |