How to add HTTPS functionality to a pywebio web server? #599
Unanswered
MinaGithuub
asked this question in
Q&A
Replies: 4 comments
|
+1 |
0 replies
|
+1 |
0 replies
|
Found the solution: (relevant code snippet of my Application class -> for webio_handler(self) you need to implement the call(self) method, where your pywebio code resides) def __call__(self):
pass
def startup(self):
if not self.certfile or not self.keyfile:
self.log.error("please provide ssl key/cert files via config")
return
if not self.dbpath or not self.db:
self.log.error("please provide a valid database path via config")
return
tornadowebapp = tornado.web.Application([
(r"/database/(.*)", tornado.web.StaticFileHandler, {"path": self.dbpath }),
(r"/(.*)", webio_handler(self)),
])
http_server = tornado.httpserver.HTTPServer(tornadowebapp, ssl_options={"certfile":self.certfile,"keyfile":self.keyfile} )
http_server.listen(port=self.port)
tornado.ioloop.IOLoop.instance().start() |
0 replies
|
much appreciated, thanks for sharing! |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
How to add HTTPS functionality to a pywebio web server?
All reactions