Python venv - works with localhost but not with ip address - HowTo solve?

Hi,
Please bear with me, I’m totally new to Python. I’m trying to get grip on a situation. Allow me to describe:

I am installing an EOS system (link). (Energy Optimisation System), and to do this I follow a youtube explainer. (in German, not my native language)

What happens is the following:

  • The first trial has been done on a Proxmox virtual machine running Debian

  • I follow all the steps (a venv is created etc)

  • Do the testing as done in the instruction video, sometimes I could connect but most of the times I could not connect)

  • As I am aware that running within a Proxmox vm limits capabilities, e.g. it is not easy to connect a monitor / keyboard / mouse directly to the virtual machine, most of the time one interacts via a web-interface.

  • To circumvent this limitation, today I repeated the complete install on a intel NUC running Debian 12.

  • The install went flawless.

  • I am able to connect to the python venv by using a browser and navigating to localhost:8503 (and some other ports too)

  • But when I try to do the same, but instead of using localhost I use the IP address:port, like this: 192.168.1.101:8503 I get connection refused. Neither of the other ports work.

  • For what it’s worth: I have also installed Node-RED, and that one is properly reacheable on the IP-address:1880

So to recap my question:
How can I debug python venv connection using IP-address instead of localhost.

Thanks for helping out!

Usually this means that your programme is listening only on the
localhost address and not the machine’s LAN IP address. i.e. you’ve had
it bind to 127.0.0.1 or localhost.

The easy thing it to bind it to 0.0.0.0 as the listen address. That
will be available on localhost and also the LAN address.

Thanks for replying!
I’ve had a look at the source material from which I copied the commands, and what strikes me is that, somehow, maybe through html rendering, not sure at all, the config data showed

--host 0.0.0.0 --port 8503

on an entirely separate line, so it is quite possible that I went wrong entering what was meant to be one prompt entry as two prompt entries.

  • Are there ways / commands to interrogate python as to what IP / port it is listening on?
  • What would be the way to correct this?
    • should this figure in some config file? I checked pyvenv.cfg but see no relevant information there..
    • do I first deactivate the venv?
    • then adjust confg?
    • Or?

Thanks for helping out and glad to learn!

I’ve had a look at the source material from which I copied the
commands, and what strikes me is that, somehow, maybe through html
rendering, not sure at all, the config data showed

--host 0.0.0.0 --port 8503

Hmm. Where’s the config data come from?

on an entirely separate line, so it is quite possible that I went wrong entering what was meant to be one prompt entry as two prompt entries.

  • Are there ways / commands to interrogate python as to what IP / port
    it is listening on?

The command netstat -an | grep 8503 should show what it’s actually
doing. Also lsof -p pid where pid is the process id of your running
python programme.

  • What would be the way to correct this?
    • should this figure in some config file? I checked pyvenv.cfg but see no relevant information there..
    • do I first deactivate the venv?
    • then adjust confg?

It shouldn’t have anything to do with the venv.

I’d be looking at:

  • the command line options you passed to the python app, if any
  • the app’s config file, if any
  • the app’s defaults

Some apps print out what they’re listening on at startup.