Skip to content
This repository
Browse code

The method I proposed in an earlier commit does not handle SSLExcepti…

…ons well (crashes the entire server when this happens). The solution is to upgrade the version of web.py you're using to the latest source instead of the older version installed via easy_install. With the new (fixed) web.py source, you can enable SSL as in the initial cookbook page.


Sorry for any confusion. This was a confusing issue to solve :)
  • Loading branch information...
commit d55d1d880f648b29a20e3874bb63a1aecbd5c60b 1 parent 91a23ef
Jordan Perr jordanperr authored

Showing 1 changed file with 18 additions and 1 deletion. Show diff stats Hide diff stats

  1. +18 1 cookbook/ssl.md
19 cookbook/ssl.md
Source Rendered
@@ -11,7 +11,24 @@ Other languages: [français](/../cookbook/ssl/fr) | ...
11 11
12 12 How to set SSL support in built-in cherrypy server web.py
13 13
14   -## Solution
  14 +## Solution (Requires latest web.py version [0.37 installed from source as of this writing])
  15 + import web
  16 + from web.wsgiserver import CherryPyWSGIServer
  17 +
  18 + CherryPyWSGIServer.ssl_certificate = "/path/to/ssl_certificate"
  19 + CherryPyWSGIServer.ssl_private_key = "/path/to/ssl_private_key"
  20 +
  21 + urls = ("/.*", "hello")
  22 + app = web.application(urls, globals())
  23 +
  24 + class hello:
  25 + def GET(self):
  26 + return 'Hello, world!'
  27 +
  28 + if __name__ == "__main__":
  29 + app.run()
  30 +
  31 +## For version 0.36 and earlier (somewhat broken implementation, will crash on SSLException)
15 32
16 33 import web
17 34 from web.wsgiserver import CherryPyWSGIServer

0 comments on commit d55d1d8

Please sign in to comment.
Something went wrong with that request. Please try again.