问题
I am trying to run a Python app in Google App Engine. The UI doesn't work so I tried using the command lines. I tried restarting my PC, I tried changing port with "dev_appserver.py --port=9999 ." but it still says Unable to bind localhost:8000:
raise BindError('Unable to bind %s:%s' % self.bind_addr)
google.appengine.tools.devappserver2.wsgi_server.BindError: Unable to bind localhost:8000
回答1:
The app server starts two servers; one for your application, the other for the development console. It is that second server that is causing the problem here; it normally would be run on port 8000.
Change the ip address for the development console with the --admin_port switch:
dev_appserver.py --admin_port=9000
You may still want to change the port for the main application server too, of course.
Also see the command-line arguments documentation for dev_appserver.py.
回答2:
It is possible some application is binding to your port in autostart event. It's highly probable to be the same service you are trying to run. In that case try killing the process
ps -ef | grep 'process_name'
Use kill -9 'pid' to end the process.
回答3:
A computer restart did it, closing google app engine launcher, restarting the computer then launching again did the trick...
回答4:
Being unable a port is usually a sign of one of two things:
- You don't have permissions
- Something is already running there.
You can try hitting the local port 8080 with your browser to see what is there, and kill it if it shouldn't be.
As for permissions - only look for this afterwards. Presuming you are in windows (you didn't specify this), then you should be able to bind this as a normal user.
As for the command line - have you tried replacing the "=" with a space - I've seen both forms in documentation for app-engine.
dev_appserver.py --port 9999 .
来源:https://stackoverflow.com/questions/27155715/unable-to-bind-local-host8000-with-google-app-engine