Not an expert, and not sure what the problem is, but see if this helps:
1) To reference the localhost IP address from the same computer, you can always use 127.0.0.1 This is a special IP address only valid as a self-reference, however; not if you want to access your computer from another computer.
2) The external localhost IP address would be assigned by your local network. It sounds as if this is being dynamically assigned, which means that everytime you login it is different. VPython and Glowscript cannot control this behavior, but it
is possible to configure the router to assign your computer a static (fixed) IP address, so that it will always be the same.
Good luck,
Harlan