Skip to content
Browse files

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...
1 parent 91a23ef commit d55d1d880f648b29a20e3874bb63a1aecbd5c60b @jordanperr jordanperr committed Jan 13, 2012
Showing with 18 additions and 1 deletion.
  1. +18 −1 cookbook/ssl.md
View
19 cookbook/ssl.md
@@ -11,7 +11,24 @@ Other languages: [français](/../cookbook/ssl/fr) | ...
How to set SSL support in built-in cherrypy server web.py
-## Solution
+## Solution (Requires latest web.py version [0.37 installed from source as of this writing])
+ import web
+ from web.wsgiserver import CherryPyWSGIServer
+
+ CherryPyWSGIServer.ssl_certificate = "/path/to/ssl_certificate"
+ CherryPyWSGIServer.ssl_private_key = "/path/to/ssl_private_key"
+
+ urls = ("/.*", "hello")
+ app = web.application(urls, globals())
+
+ class hello:
+ def GET(self):
+ return 'Hello, world!'
+
+ if __name__ == "__main__":
+ app.run()
+
+## For version 0.36 and earlier (somewhat broken implementation, will crash on SSLException)
import web
from web.wsgiserver import CherryPyWSGIServer

0 comments on commit d55d1d8

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