How to add HTTPS functionality to a pywebio web server? #599
Unanswered
MinaGithuub
asked this question in
Q&A
Replies: 4 comments
-
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() |
Beta Was this translation helpful? Give feedback.
0 replies
-
much appreciated, thanks for sharing! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How to add HTTPS functionality to a pywebio web server?
Beta Was this translation helpful? Give feedback.
All reactions