How to set web ip to another

100 views
Skip to first unread message

Japko

unread,
Feb 12, 2021, 3:37:01 AM2/12/21
to Tornado Web Server
Hi,

I'm trying to change ip on which is working tornado, I have ready solution which uses tornado and it's calling it like this

app = tornado.web.Application(
handlers,
template_path=os.path.join(web_root, 'templates'),
static_path=os.path.join(web_root, 'static'),
debug=True,
cookie_secret=helper.random_string_generator(20),
xsrf_cookies=True,
autoreload=False,
log_function=self.log_function, login_url="/",
default_handler_class=My404Handler,
default_host="[my:ipv6:addr:used:in:dns]") 

self.http_server = tornado.httpserver.HTTPServer(app, ssl_options=cert_objects) self.http_server.listen(port_number) tornado.locale.load_translations(os.path.join(web_root, 'translations'))
self.ioloop = tornado.ioloop.IOLoop.instance() self.ioloop.start()

it seems to be working on ipv4 loopback 127.0.0.1 address and itsn't accessible via ipv6 address. 

Ben Darnell

unread,
Feb 15, 2021, 11:25:43 AM2/15/21
to Tornado Mailing List
The `default_host` argument has very limited uses: you may need it if you're calling `Application.add_handlers` with multiple hostnames, but it only affects URL routing. It doesn't control whether the server is accessible at all. As I said in the other thread, what you probably need is the `address` argument to the `HTTPServer.listen` or `HTTPServer.bind` methods (although it's supposed to work out of the box).

-Ben


--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornad...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-tornado/29a32ec7-1ec3-431f-9900-d13372d71c1en%40googlegroups.com.

Japko

unread,
Mar 9, 2021, 2:26:35 PM3/9/21
to Tornado Web Server
Hi, 

Thanks for response!

I've changed call:
self.http_server.listen(port_number)
with:
self.http_server.listen(port_number, "myip:v6ad:dress:whic:hisp:ubli:c")

Also had to remove "ssl_options=cert_objects", as it was self-signed certificate and my browser from external machine didn't want to connect, after that it all works!
Reply all
Reply to author
Forward
0 new messages