mercredi 23 décembre 2020

Does anyone know of a way to fix CherryPy ssl protocol error?

CherryPy works for around 5 minutes with ssl on and then the you try to reach it, it shows the error ssl protocol error.

class Webpage:
    @cherrypy.expose
    def products(self):
        response = ""
        with open(STORAGEDIR + "productos.csv", "r") as f:
            text = f.read()
            response = text.replace('\n', ';')
        return response


def runserver():
    cherrypy.tree.mount(Webpage(), '/', config={
        '/': {
            'tools.staticdir.on': True,
            'tools.staticdir.dir': "/Users/etethanhanordaz/Documents/Zulima",
            'tools.staticdir.index': 'index.html'
        }
    })

    cherrypy.config.update({
        'server.socket_port': 443,
        'server.socket_host': '0.0.0.0',
        'server.ssl_module': 'builtin',
        'server.ssl_certificate': '/Users/etethanhanordaz/letsencrypt/config/live/website.com/cert.pem',
        'server.ssl_certificate_chain': '/Users/etethanhanordaz/letsencrypt/config/live/website.com/chain.pem',
        'server.ssl_private_key': '/Users/etethanhanordaz/letsencrypt/config/live/website.com/privkey.pem'
    })

    try:
        cherrypy.engine.start()
        cherrypy.engine.block()
    except KeyboardInterrupt:
        cherrypy.engine.stop()


runserver()

does anyone know the solution, or an alternative python module that can also self host and host static directories? I am currently using CherryPy 18.6




Aucun commentaire:

Enregistrer un commentaire