Python cherrypy.quickstart() Examples

The following are 29 code examples of cherrypy.quickstart(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module cherrypy , or try the search function .
Example #1
Source File: server.py    From ScoutSuite with GNU General Public License v2.0 6 votes vote down vote up
def init(database_filename, host, port):
        """
        Configure and starts the server.

        :param database_filename:       Location of the database file.
        :param host:                    Address on which to listen.
        :param port:                    Port on which to listen.
        """
        cherrypy_cors.install()
        config = {
            '/': {
                'cors.expose.on': True,
                'tools.sessions.on': True,
                'tools.response_headers.on': True,
                'tools.response_headers.headers': [('Content-Type', 'text/plain')],
            },
        }
        cherrypy.config.update({
                'server.socket_host': host,
                'server.socket_port': port,
        })
        cherrypy.quickstart(Server(database_filename), "/api", config=config) 
Example #2
Source File: covercp.py    From opsbro with MIT License 5 votes vote down vote up
def serve(path=localFile, port=8080, root=None):
    if coverage is None:
        raise ImportError("The coverage module could not be imported.")
    from coverage import coverage
    cov = coverage(data_file=path)
    cov.load()

    import cherrypy
    cherrypy.config.update({'server.socket_port': int(port),
                            'server.thread_pool': 10,
                            'environment': "production",
                            })
    cherrypy.quickstart(CoverStats(cov, root)) 
Example #3
Source File: http.py    From zstack-utility with Apache License 2.0 5 votes vote down vote up
def start(self):
        self._build()
        cherrypy.quickstart(self.server) 
Example #4
Source File: agentServer.py    From deel with MIT License 5 votes vote down vote up
def StartAgent(trainer=None,port=8765):
	global workout
	workout = trainer
	cherrypy.config.update({'server.socket_port': port})
	WebSocketPlugin(cherrypy.engine).subscribe()
	cherrypy.tools.websocket = WebSocketTool()
	cherrypy.config.update({'engine.autoreload.on': False})
	config = {'/ws': {'tools.websocket.on': True,
					  'tools.websocket.handler_cls': AgentServer}}
	cherrypy.quickstart(Root(), '/', config) 
Example #5
Source File: gather_keys_oauth2.py    From fitbit-analyzer with Apache License 2.0 5 votes vote down vote up
def browser_authorize(self):
        """
        Open a browser to the authorization url and spool up a CherryPy
        server to accept the response
        """
        url, _ = self.oauth.authorize_token_url(redirect_uri=self.redirect_uri)
        # Open the web browser in a new thread for command-line browser support
        threading.Timer(1, webbrowser.open, args=(url,)).start()
        cherrypy.quickstart(self) 
Example #6
Source File: covercp.py    From moviegrabber with GNU General Public License v3.0 5 votes vote down vote up
def serve(path=localFile, port=8080, root=None):
    if coverage is None:
        raise ImportError("The coverage module could not be imported.")
    from coverage import coverage
    cov = coverage(data_file = path)
    cov.load()
    
    import cherrypy
    cherrypy.config.update({'server.socket_port': int(port),
                            'server.thread_pool': 10,
                            'environment': "production",
                            })
    cherrypy.quickstart(CoverStats(cov, root)) 
Example #7
Source File: profiler.py    From moviegrabber with GNU General Public License v3.0 5 votes vote down vote up
def serve(path=None, port=8080):
    if profile is None or pstats is None:
        msg = ("Your installation of Python does not have a profile module. "
               "If you're on Debian, try `sudo apt-get install python-profiler`. "
               "See http://www.cherrypy.org/wiki/ProfilingOnDebian for details.")
        warnings.warn(msg)
    
    import cherrypy
    cherrypy.config.update({'server.socket_port': int(port),
                            'server.thread_pool': 10,
                            'environment': "production",
                            })
    cherrypy.quickstart(Profiler(path)) 
Example #8
Source File: authorization.py    From python-alexa-voice-service with MIT License 5 votes vote down vote up
def get_authorization():
    # Load configuration dictionary
    config = helper.read_dict('config.dict')

    cherrypy.config.update({'server.socket_host': '0.0.0.0', })
    cherrypy.config.update({'server.socket_port': int(os.environ.get('PORT', '5000')), })
    cherrypy.quickstart(Start(config)) 
Example #9
Source File: covercp.py    From Tautulli with GNU General Public License v3.0 5 votes vote down vote up
def serve(path=localFile, port=8080, root=None):
    if coverage is None:
        raise ImportError('The coverage module could not be imported.')
    from coverage import coverage
    cov = coverage(data_file=path)
    cov.load()

    cherrypy.config.update({'server.socket_port': int(port),
                            'server.thread_pool': 10,
                            'environment': 'production',
                            })
    cherrypy.quickstart(CoverStats(cov, root)) 
Example #10
Source File: profiler.py    From Tautulli with GNU General Public License v3.0 5 votes vote down vote up
def serve(path=None, port=8080):
    if profile is None or pstats is None:
        msg = ('Your installation of Python does not have a profile module. '
               "If you're on Debian, try "
               '`sudo apt-get install python-profiler`. '
               'See http://www.cherrypy.org/wiki/ProfilingOnDebian '
               'for details.')
        warnings.warn(msg)

    cherrypy.config.update({'server.socket_port': int(port),
                            'server.thread_pool': 10,
                            'environment': 'production',
                            })
    cherrypy.quickstart(Profiler(path)) 
Example #11
Source File: server.py    From spyre with MIT License 5 votes vote down vote up
def launch(self, host="local", port=8080):
        """Calling the Launch method on a Site object will serve the top
            node of the cherrypy Root object tree"""

        # Need to add in the appbar if many apps
        self.root.templateVars['app_bar'] = self.site_app_bar
        for fullRoute, _ in self.site_app_bar[1:]:
            parent, route = self.get_route(fullRoute)
            parent.__dict__[route].templateVars['app_bar'] = self.site_app_bar

        if host != "local":
            cherrypy.server.socket_host = '0.0.0.0'
        cherrypy.server.socket_port = port
        cherrypy.quickstart(self.root) 
Example #12
Source File: server.py    From spyre with MIT License 5 votes vote down vote up
def launch(self, host="local", port=8080, prefix='/', config=None):
        self.prefix = prefix
        webapp = self.getRoot()
        if host != "local":
            cherrypy.server.socket_host = '0.0.0.0'
        cherrypy.server.socket_port = port
        cherrypy.tree.mount(webapp, prefix)
        cherrypy.quickstart(webapp, config=config) 
Example #13
Source File: webservice.py    From script.skin.helper.service with GNU General Public License v2.0 5 votes vote down vote up
def run(self):
        log_msg("Starting WebService on port %s" % PORT, xbmc.LOGNOTICE)
        conf = {
            'global': {
                'server.socket_host': '0.0.0.0',
                'server.socket_port': PORT
            }, '/': {}
        }
        cherrypy.quickstart(self.__root, '/', conf) 
Example #14
Source File: covercp.py    From bazarr with GNU General Public License v3.0 5 votes vote down vote up
def serve(path=localFile, port=8080, root=None):
    if coverage is None:
        raise ImportError('The coverage module could not be imported.')
    from coverage import coverage
    cov = coverage(data_file=path)
    cov.load()

    import cherrypy
    cherrypy.config.update({'server.socket_port': int(port),
                            'server.thread_pool': 10,
                            'environment': 'production',
                            })
    cherrypy.quickstart(CoverStats(cov, root)) 
Example #15
Source File: profiler.py    From bazarr with GNU General Public License v3.0 5 votes vote down vote up
def serve(path=None, port=8080):
    if profile is None or pstats is None:
        msg = ('Your installation of Python does not have a profile module. '
               "If you're on Debian, try "
               '`sudo apt-get install python-profiler`. '
               'See http://www.cherrypy.org/wiki/ProfilingOnDebian '
               'for details.')
        warnings.warn(msg)

    cherrypy.config.update({'server.socket_port': int(port),
                            'server.thread_pool': 10,
                            'environment': 'production',
                            })
    cherrypy.quickstart(Profiler(path)) 
Example #16
Source File: profiler.py    From cherrypy with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def serve(path=None, port=8080):
    if profile is None or pstats is None:
        msg = ('Your installation of Python does not have a profile module. '
               "If you're on Debian, try "
               '`sudo apt-get install python-profiler`. '
               'See http://www.cherrypy.org/wiki/ProfilingOnDebian '
               'for details.')
        warnings.warn(msg)

    cherrypy.config.update({'server.socket_port': int(port),
                            'server.thread_pool': 10,
                            'environment': 'production',
                            })
    cherrypy.quickstart(Profiler(path)) 
Example #17
Source File: profiler.py    From opsbro with MIT License 5 votes vote down vote up
def serve(path=None, port=8080):
    if profile is None or pstats is None:
        msg = ("Your installation of Python does not have a profile module. "
               "If you're on Debian, try "
               "`sudo apt-get install python-profiler`. "
               "See http://www.cherrypy.org/wiki/ProfilingOnDebian "
               "for details.")
        warnings.warn(msg)

    import cherrypy
    cherrypy.config.update({'server.socket_port': int(port),
                            'server.thread_pool': 10,
                            'environment': "production",
                            })
    cherrypy.quickstart(Profiler(path)) 
Example #18
Source File: runtime_web.py    From binner with MIT License 5 votes vote down vote up
def run( self, args ):
       api =  RuntimeWebAPI()
       global_config = {
          "server.socket_host": args.host,
          "server.socket_port": int(args.port)
        } 
       my_config = {"/": {}}
       cherrypy.config.update(global_config)
       cherrypy.quickstart(api, "/", config=my_config) 
Example #19
Source File: webui.py    From disk_perf_test_tool with Apache License 2.0 5 votes vote down vote up
def web_main_thread(sensors_data_storage):

    cherrypy.config.update({'environment': 'embedded',
                            'server.socket_port': 8089,
                            'engine.autoreload_on': False})

    th = threading.Thread(None, backfill_thread, "backfill_thread",
                          (sensors_data_storage,))
    th.daemon = True
    th.start()

    cherrypy.quickstart(WebWally(sensors_data_storage), '/') 
Example #20
Source File: server.py    From Linux-Kernel-CTF with MIT License 5 votes vote down vote up
def main():
    # Start web server
    cherrypy.config.update({"server.socket_host": "0.0.0.0", "server.socket_port": 80})
    cherrypy.quickstart(Root(), "/") 
Example #21
Source File: startquill_cherry.py    From Quillpad-Server with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def main() :
    """
    cherrypy.root = QuillCherry()
    cherrypy.root.quillpad_backend = cherrypy.root
    cherrypy.config.update( file='quill_cherry8088.conf')
    cherrypy.config.update({'thread_pool': 10})
    cherrypy.server.start()
    """
    cherrypy._cpconfig.Config('quill_cherry8088.conf')
    quillCherry = QuillCherry()
    cherrypy.quickstart(quillCherry) 
Example #22
Source File: couchdeploy.py    From nosqlpot with GNU General Public License v2.0 5 votes vote down vote up
def coudeploy():

	serverconf = os.path.join(os.path.dirname(__file__), 'server.conf')
	def error_404(status, message, traceback, version):
		return '''{"error":"not_found","reason":"no_db_file"}'''
	error_404.exposed = True

	cherrypy.config.update({'error_page.404':error_404})
	access_log = cherrypy.log.access_log
	cherrypy.quickstart(Couchpot(), config=serverconf) 
Example #23
Source File: main.py    From labs with MIT License 5 votes vote down vote up
def main():
    """Main."""
    conf = {
        "/": {
            'tools.sessions.on': True,
        }
    }
    cherrypy.quickstart(TuxyBot(), "/", conf) 
Example #24
Source File: main.py    From labs with MIT License 5 votes vote down vote up
def main():
    """Main."""
    conf = {
        "/": {
            'request.dispatch': cherrypy.dispatch.MethodDispatcher()
        }
    }
    cherrypy.quickstart(TuxyCaptcha(), "/", conf) 
Example #25
Source File: httpproxy.py    From plugin.audio.spotify with GNU General Public License v3.0 5 votes vote down vote up
def run(self):
        conf = { '/': {}}
        cherrypy.quickstart(self.__root, '/', conf) 
Example #26
Source File: server.py    From bbj with MIT License 5 votes vote down vote up
def run():
    _c = sqlite3.connect(dbname)
    try:
        db.set_admins(_c, app_config["admins"])
        # user anonymity is achieved in the laziest possible way: a literal user
        # named anonymous. may god have mercy on my soul.
        db.anon = db.user_resolve(_c, "anonymous")
        if not db.anon:
            db.anon = db.user_register(
                _c, "anonymous",  # this is the hash for "anon"
                "5430eeed859cad61d925097ec4f53246"
                "1ccf1ab6b9802b09a313be1478a4d614")
    finally:
        _c.close()
    cherrypy.quickstart(API(), "/api", API_CONFIG) 
Example #27
Source File: auth_fitbit.py    From fitbit-googlefit with GNU General Public License v3.0 5 votes vote down vote up
def browser_authorize(self):
        """
        Open a browser to the authorization url and spool up a CherryPy
        server to accept the response
        """
        url, _ = self.oauth.authorize_token_url(redirect_uri=self.redirect_uri)
        # Open the web browser in a new thread for command-line browser support
        threading.Timer(1, webbrowser.open, args=(url,)).start()
        cherrypy.quickstart(self) 
Example #28
Source File: covercp.py    From cherrypy with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def serve(path=localFile, port=8080, root=None):
    if coverage is None:
        raise ImportError('The coverage module could not be imported.')
    from coverage import coverage
    cov = coverage(data_file=path)
    cov.load()

    cherrypy.config.update({'server.socket_port': int(port),
                            'server.thread_pool': 10,
                            'environment': 'production',
                            })
    cherrypy.quickstart(CoverStats(cov, root)) 
Example #29
Source File: thermostat.py    From thermostat with MIT License 4 votes vote down vote up
def startWebServer():	
	host = "discover" if not( settings.exists( "web" ) ) else settings.get( "web" )[ "host" ]
	cherrypy.server.socket_host = host if host != "discover" else get_ip_address()								# use machine IP address if host = "discover"
	cherrypy.server.socket_port = 80 if not( settings.exists( "web" ) ) else settings.get( "web" )[ "port" ]

	log( LOG_LEVEL_STATE, CHILD_DEVICE_WEBSERVER, MSG_SUBTYPE_TEXT, "Starting on " + cherrypy.server.socket_host + ":" + str( cherrypy.server.socket_port ) )

	conf = {
		'/': {
			'tools.staticdir.root': os.path.abspath( os.getcwd() ),
			'tools.staticfile.root': os.path.abspath( os.getcwd() )
		},
		'/css': {
			'tools.staticdir.on': True,
			'tools.staticdir.dir': './web/css'
		},
		'/javascript': {
			'tools.staticdir.on': True,
			'tools.staticdir.dir': './web/javascript'
		},
		'/images': {
			'tools.staticdir.on': True,
			'tools.staticdir.dir': './web/images'
		},
		'/schedule.json': {
			'tools.staticfile.on': True,
			'tools.staticfile.filename': './thermostat_schedule.json'
		},
		'/favicon.ico': {
			'tools.staticfile.on': True,
			'tools.staticfile.filename': './web/images/favicon.ico'
		}

	}

	cherrypy.config.update(
		{ 'log.screen': debug,
		  'log.access_file': "",
		  'log.error_file': ""
		}
	)

	cherrypy.quickstart ( WebInterface(), '/', conf )	


##############################################################################
#                                                                            #
#       Main                                                                 #
#                                                                            #
##############################################################################