I have flask/python app that I am running from my virtual desktop using flask run command. It used to run fine with below command.
flask run -h (ip address) -p 8000
But recently I am getting below error.
Traceback (most recent call last):
File "C:\ProgramData\Anaconda2\lib\SocketServer.py", line 431, in server_bind
self.socket.bind(self.server_address)
File "C:\ProgramData\Anaconda2\lib\socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.gaierror: [Errno 11001] getaddrinfo failed
I am able to connect to localhost - 127.0.0.1. But, I am getting above error when I connect to IP address.
I want everyone to be able to open this app on their own system. For this, app should be hosted on IP address. On localhost(127.0.0.1), only my system can open it.
I am running this on company laptop, hence there could also be a firewall involved in this.
Can someone please help me resolve this issue.
getaddrinfo failed means the hostname can't be resolved, maybe the -h (ip address) is wrong, please add the full command you use to start the application.
Generally in production the -h parameter is 0.0.0.0 (to allow all clients to communicate with your server), so your command should be:
flask run -h '0.0.0.0' -p 8000
Related
When trying to connect to tensorboard logs on a remote server and entering the address http://localhost:16006/ in chrome and firefox I get this message in the command line "channel 3: open failed: connect failed: Connection refused" multiple times and this message on the browser, "The Connection was Reset".
I ssh into the server like this: ssh -L 16006:127.0.0.1:6006 username#machine and then go one level up the log folder and write: tensorboard --logdir logs --port 16006
I tired:
tensorboard --logdir logs --port 16006 --bind-all
and also
tensorboard --logdir logs --host localhost, also
tensorboard --logdir logs --host 127.0.0.1
None of the above has wroked. I tried running the line above from another environment which didn't help. I went to the office and tried connecting to the logs from the server machine directly and it worked.
It used to work before when accessing remotely. Do you know what the problem is? any hint would be immensely appreciated.
I am having the same problem, but I think you should designate --port 6006 since it looks like you are forwarding remote port 6006 to the local port 16006.
Even so, since 6006 is the default port, the other commands should have worked, but you would have to go to http://127.0.0.1:16006 on your local machine, rather than the link it provides.
Some more in depth explanations can be found here how to run tensorboard on a remote server and how to see tensorboard over ssh
Even following this advice though I am still getting a 'channel 3: open failed: connect failed: Connection failed' error
i am following this module lab: https://docs.aws.amazon.com/greengrass/latest/developerguide/module5.html
All previous ones run fine. Greengrass is on my RPi in the same network as my PC. RPi has 192.168.1.101 and i can ping it. Also I have "manually manage connection information" set with 1 only IP.
When i start the Python script through:
python lightController.py --endpoint ....
I get always this error:
2019-03-10 16:50:20,805 - AWSIoTPythonSDK.core.protocol.mqtt_core - INFO - Keep-alive:+ +600.000000 sec
Traceback (most recent call last):
File "lightController.py", line 203, in <module>
myAWSIoTMQTTShadowClient.connect()
.....
ConnectionRefusedError: WinError 10061 No connection could be made because the target machine actively refused it
I have no firewall or proxy between PC and RPi. Why is that error?
thanks lot
I was facing the exact same issue. Turns out it was due to an incorrect root certificate. When you add the root certificate to the common folder (that includes the trafficlight.py file and the other shadow device certs and pems) and run the code, it creates a groupCA folder. I think, beyond a span of time between adding the root certificate to this folder and running the command, the token probably expires? In any case, I deleted the folder and ran the command again, and that fixed the issue.
Hope this helps someone out there.
Edit: Just went through the 'Note' in the Greengrass guide, and it mentions this line clearly:
The lightController.py and trafficLight.py scripts store connection information in the groupCA folder, which is created in the same folder as the scripts. If you receive connection errors, make sure that the IP address in the ggc-host file matches the single IP address endpoint that you configured for your core in this step.
I created a TCP server program (see server.py) to access the terminal of another computer (see client.py). When I use the client and server locally (only on my computer) everything is fine, however when the client is sending a request from a different computer, I receive this message on the client side :
Traceback (most recent call last):
File "client.py", line 11, in <module>
client.connect((serverIP, serverPort))
File "/usr/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 111] Connection refused
Note : the server is the computer which is being accessed by the client.
'Connection refused' means there was nothing listening at the IP:port you tried to connect to.
It comes from the target system, which means that the connection request got there and the refusal came back, so it isn't a firewall issue.
Solved it. I had to use the IP given to in when running ifconfig (192.168.1.***). I was binding to localhost, and thus I could not connect to the server remotely.
I just begun using Flask and tried to run the hello_world example (hello.py)
The point is that I run the server through ssh on a remote machine and I want to browse it from my local machine so I used
app.run(host='0.0.0.0'),
However when I browse on chrome I put let's say http: //RemoteMachineIP:5000/ I got:
Oops! Google Chrome could not connect to RemoteMachineIP:5000
The remote machine has multiple ethernet IP addresses so I tried them (as http: //RemoteMachineIP:5000/) and I am always getting the same error.
I have also tried using app.run(host='LocalMachineIP') in hello.py but I got this error Flask [Errno 99] Cannot assign requested address.
Am I missing something ?
If you can run the server but the browser won't see it, it is a firewall problem.
If you can't assign the ip port, probably there is a PID already using the port, so you should try
lsof -i :5000
Then
kill -9 [PID From the lsof]
Attempting to deploy a django project with gnotty as part of it, which works perfectly well on the localhost but as soon as I deployed and changed the GNOTTY_HOST to my domain, the GNOTTY_PORT to 80, and the GNOTTY_DAEMON to True, as well as the pid file with an absolute path to a pid file.
Now, when I try to use the app by going to mydomain.net/irc/ then connecting with a nickname, it loads and then I get "Took too long to connect, please try again" so I tried to run manage.py gnottify to see if I got an error and there it was: gnotty/0.2.5 [Bot: BaseBot] listening on http://mydomain.net/:80
gaierror: [Errno -5] No address associated with hostname: ('http://mydomain.net/', 80)
Exception KeyError: KeyError(29425008,) in ignored
Sounds like dns isn't resolving. Have you tried using dig our nslookup?