Hello. There is a server on the Bottle: Python Web Framework (thanks to the jfs user), the host indicated the IP computer, and not localhost (as in all examples). The server eventually starts up, but I don’t get into the directory from which the server is running into the address bar 192.168.0.2:800 . Tried on the computer at work, there is no such problem. Firewall and antivirus disabled. OS Windows 7 . Did anyone have this problem?

 #!/usr/bin/env python from bottle import route, request, run, template $pip install bottle temperature = None @route('/') def index(): global temperature temperature = request.query.temperature or temperature return template('<b>Temperature: {{temperature}}</b>', temperature=temperature) run(host='192.168.0.2', port=800) 
  • I do not get into the directory from which the server is running And where do you get to? - Akina
  • Nowhere - "Unable to access the site." The problem is not with the server - everything works as it should on another computer. - soadmized
  • If you tell me the name of your server, I will help. - Insider
  • It has no name - the http-server is written in python using the bottle library, inserted the code into the question @Insider - soadmized
  • what is the IP адрес the machine where this framework is running? - Insider

1 answer 1

Your code contains the settings host='192.168.0.198', port=8080 and this is not correct. The fact is that this setting indicates which computer and on which port has access to this server / directory. In order for everything to work and you have access to the server / directory from any computer, you need to set the host='0.0.0.0', port=8080 settings host='0.0.0.0', port=8080 . Now you can enter the web page located on the server through the ip-сервера:8080/ . If you want the server to use port 80 , just replace 8080 with 80 . But! When using port 80 , you will need to start the server through sudo .

There are similar frameworks like Bottle , for example Flask . They all use the same setup. I advise you to carefully read the documentation.

  • this is not true: "which computer and which port has access to this server / directory" . host='192.168.0.198' not the ip of the client trying to access the server. host='192.168.0.198' indicates what address the server will listen to ( '0.0.0.0' means to listen on all network interfaces). - jfs
  • Because it works for me. - Insider
  • the explanation may be erroneous and at the same time a workaround may work (this leads to cargo-cult programming ). In the absence of understanding, the solution may stop working / lead to undesirable side effects as it happened with the cure for scurvy, which helped the British Empire to build. - jfs