AttributeError: ‘Context’ object has no attribute ‘wrap_socket’

As of 0.10, Werkzeug doesn’t support OpenSSL contexts anymore. This decision was made because it is easier to support ssl.SSLContext across Python versions. Your option to re-write this code is this one:

if __name__ == "__main__":
    context = ('cert.crt', 'key.key')
    app.run(host="0.0.0.0", port=80, ssl_context=context, threaded=True, debug=True)

See http://werkzeug.pocoo.org/docs/latest/serving/ for all possibilities.

Leave a Comment

tech