def SvcDoRun(self): # in practice, you will want to specify a value for # log.error_file below or in your config file. If you # use a config file, be sure to use an absolute path to # it, as you can't be assured what path your service # will run in. cherrypy.config.update({ 'global': { 'server.socket_host': '0.0.0.0', 'server.socket_port': 8090, 'log.screen': False, 'engine.autoreload.on': False, 'engine.SIGHUP': None, 'engine.SIGTERM': None } }) service_settings.setup_env() DjangoAppPlugin(cherrypy.engine, service_settings).subscribe() cherrypy.engine.start() cherrypy.engine.block()
def SvcDoRun(self): # in practice, you will want to specify a value for # log.error_file below or in your config file. If you # use a config file, be sure to use an absolute path to # it, as you can't be assured what path your service # will run in. cherrypy.config.update({ 'global':{ 'server.socket_host': '0.0.0.0', 'server.socket_port': 8090, 'log.screen': False, 'engine.autoreload.on': False, 'engine.SIGHUP': None, 'engine.SIGTERM': None } }) service_settings.setup_env() DjangoAppPlugin(cherrypy.engine, service_settings).subscribe() cherrypy.engine.start() cherrypy.engine.block()
using WSGI and CherryPy's capabilities to serve it. In order to configure the application, we use the `settings.configure(...)` function provided by Django. Since the CherryPy WSGI server doesn't offer a log facility, we add a straightforward WSGI middleware to do so, based on the CherryPy built-in logger. Obviously any other log middleware can be used instead. Note this application admin site uses the following credentials: admin/admin Thanks to Damien Tougas for his help on this recipe. """ if __name__ == '__main__': import cherrypy import os cherrypy.config.update({ 'server.socket_host': '0.0.0.0', 'server.socket_port': 8090, 'checker.on': False, }) from djangoplugin import DjangoAppPlugin import service_settings service_settings.setup_env() DjangoAppPlugin(cherrypy.engine, service_settings).subscribe() cherrypy.quickstart()