Python cherrypy.quickstart() Examples

The following are 29 code examples for showing how to use cherrypy.quickstart(). These examples are extracted from open source projects. 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 check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module cherrypy , or try the search function .

Example 1
Project: ScoutSuite   Author: nccgroup   File: server.py    License: 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
Project: cherrypy   Author: cherrypy   File: profiler.py    License: 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 3
Project: cherrypy   Author: cherrypy   File: covercp.py    License: 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 4
Project: fitbit-googlefit   Author: praveendath92   File: auth_fitbit.py    License: 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 5
Project: bbj   Author: bbj-dev   File: server.py    License: 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 6
Project: plugin.audio.spotify   Author: kodi-community-addons   File: httpproxy.py    License: GNU General Public License v3.0 5 votes vote down vote up
def run(self):
        conf = { '/': {}}
        cherrypy.quickstart(self.__root, '/', conf) 
Example 7
Project: labs   Author: alexcoman   File: main.py    License: MIT License 5 votes vote down vote up
def main():
    """Main."""
    conf = {
        "/": {
            'request.dispatch': cherrypy.dispatch.MethodDispatcher()
        }
    }
    cherrypy.quickstart(TuxyCaptcha(), "/", conf) 
Example 8
Project: labs   Author: alexcoman   File: main.py    License: MIT License 5 votes vote down vote up
def main():
    """Main."""
    conf = {
        "/": {
            'tools.sessions.on': True,
        }
    }
    cherrypy.quickstart(TuxyBot(), "/", conf) 
Example 9
Project: nosqlpot   Author: torque59   File: couchdeploy.py    License: 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 10
Project: Quillpad-Server   Author: teamtachyon   File: startquill_cherry.py    License: 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 11
Project: Linux-Kernel-CTF   Author: mncoppola   File: server.py    License: 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 12
Project: disk_perf_test_tool   Author: Mirantis   File: webui.py    License: 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 13
Project: binner   Author: nadirhamid   File: runtime_web.py    License: 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 14
Project: opsbro   Author: naparuba   File: profiler.py    License: 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 15
Project: opsbro   Author: naparuba   File: covercp.py    License: 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 16
Project: bazarr   Author: morpheus65535   File: profiler.py    License: 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 17
Project: bazarr   Author: morpheus65535   File: covercp.py    License: 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 18
Project: script.skin.helper.service   Author: kodi-community-addons   File: webservice.py    License: 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 19
Project: spyre   Author: adamhajari   File: server.py    License: 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 20
Project: spyre   Author: adamhajari   File: server.py    License: 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 21
Project: Tautulli   Author: Tautulli   File: profiler.py    License: 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 22
Project: Tautulli   Author: Tautulli   File: covercp.py    License: 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 23
Project: python-alexa-voice-service   Author: nicholasjconn   File: authorization.py    License: 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 24
Project: moviegrabber   Author: binhex   File: profiler.py    License: 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 25
Project: moviegrabber   Author: binhex   File: covercp.py    License: 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 26
Project: fitbit-analyzer   Author: 5agado   File: gather_keys_oauth2.py    License: 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 27
Project: deel   Author: uei   File: agentServer.py    License: 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 28
Project: zstack-utility   Author: zstackio   File: http.py    License: Apache License 2.0 5 votes vote down vote up
def start(self):
        self._build()
        cherrypy.quickstart(self.server) 
Example 29
Project: thermostat   Author: chaeron   File: thermostat.py    License: 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                                                                 #
#                                                                            #
##############################################################################