tjwalch/django-livereload-server

Error with changing LIVERELOAD_HOST

Closed this issue · 4 comments

Trying to change LIVERELOAD_HOST to `10.10.10.10´ gives me error.

[I 181031 13:51:11 server:141] Serving on http://10.10.10.20:35729
Traceback (most recent call last):
  File "/app/website/manage.py", line 12, in <module>
    execute_from_command_line(sys.argv)
  File "/app/env/lib/python3.4/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/app/env/lib/python3.4/site-packages/django/core/management/__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/app/env/lib/python3.4/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/app/env/lib/python3.4/site-packages/django/core/management/base.py", line 335, in execute
    output = self.handle(*args, **options)
  File "/app/env/lib/python3.4/site-packages/livereload/management/commands/livereload.py", line 62, in handle
    liveport=options['port'],
  File "/app/env/lib/python3.4/site-packages/livereload/server.py", line 143, in serve
    self.application('10.10.10.20', liveport=liveport)
  File "/app/env/lib/python3.4/site-packages/livereload/server.py", line 130, in application
    live.listen(liveport, address=host)
  File "/app/env/lib/python3.4/site-packages/tornado/web.py", line 2042, in listen
    server.listen(port, address)
  File "/app/env/lib/python3.4/site-packages/tornado/tcpserver.py", line 143, in listen
    sockets = bind_sockets(port, address=address)
  File "/app/env/lib/python3.4/site-packages/tornado/netutil.py", line 168, in bind_sockets
    sock.bind(sockaddr)
OSError: [Errno 99] Cannot assign requested address

However I was able to set the REMOTE_HOST to 0.0.0.0 but then the middleware include fails of course.

You realize that this error is from Python standard library and probably originates in the interaction with the OS on a very low level? This is well beyond the scope of livereload-server. You will get the same error trying to run anything under that IP.
I have run livereload with host 0.0.0.0 and have had no trouble. The livereload server is a tornado service, it doesn't use any django middleware.

I realize that, I should have been clearer. Let me clarify a bit. When running django inside a container, the containers is reachable trough a ip, in my case it was 10.10.10.20. So I would need the livereload server to be started with LIVERELOAD_HOST=0.0.0.0 but would need the middleware to inject the listneer host as 10.10.10.20. I fixed this for my self by adding another setting LIVERELOAD_MIDDLEWARE_HOST and some addition code. How else would one get it to work in this scenario? Thanks for your reply and work.

Set LIVERELOAD_HOST=10.10.10.20 in your settings. Start livereload inside container with livereload --host=0.0.0.0. Problem solved, and everything you needed to know was already in the docs :)

Lol .. I failed to see the distiction that --host could be set as well as LIVERELOAD_HOST my bad, and thanks for the clarification.