mardi 4 août 2015

CherryPy with Bottle sometimes doesn't reload

I'm using the Bottle framework, CherryPy, and nginx doing reverse proxy. I have a problem where randomly autoreload won't restart the process but does kill off the old one, thus leaving the site down. I'm new to hosting on Linux, coding in Python, using CherryPy, and using nginx.

Is there a default log some place (I'm running Ubuntu server) that might have information as to why it doesn't restart? Or something I can enable to figure out why? It's been awesome otherwise, just this one problem and it seems to happen completely randomly.

Here's what my CherryPy code looks like:

import cherrypy as cp
from bottle import Bottle

APP = Bottle()

def run(app, host='0.0.0.0', port=8090, **config):
    cp.tree.graft(app, '/')
    cp.config.update(config)
    cp.config.update({
        'server.socket_port': port,
        'server.socket_host': host,
    })
    cp.engine.signals.subscribe()
    cp.engine.start()
    cp.engine.block()


if __name__ == '__main__':
    run(APP)

I'm not sure if this is the optimal way. I found this on a different stackoverflow question.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire