简体   繁体   中英

Can't connect to localhost:8080 when trying to run Google App Engine program

I'm trying to run the Google App Engine Python 2.7 Hello World program and view it in a browser via Google App Engine Launcher. I followed the install and program instructions to the letter. I copied and pasted the code in the instructions to the helloworld.py file and app.yam1 and verified that they are correct and in the directory listed as the application directory. I hit run on the launcher and it runs with no errors, although I get no sign that is has completed (orange clock symbol next to app name). I get the following from the logs:

  • Running dev_appserver with the following flags: --skip_sdk_update_check=yes --port=8080 --admin_port=8000 Python command: /opt/local/bin/python2.7

When I try to open in the browser via the GAE Launcher, the 'browse' icon is grayed out and the browser won't open. I tried opening localhost:8080 in Firefox and Chrome as the tutorial suggests, but I get unable to connect errors from both.

How can I view Hello World in a browser? Is there some configuration I need to make on my machine?

I had the same problem. This seemed to fix it:

cd to google_appengine, run

python dev_appserver.py --port=8080 --host=127.0.0.1 /path/to/application

at this point there is a prompt to allow updates on running, I said Yes.

At this point the app was running as it should, also when I quit this and went in using the launcher again, that worked too.

I have to manually start python and make it point to my app folder, for instance in a command line window on Windows I am using python. I installed python in C:\\Python27 and my sample app is in c:\\GoogleApps\\guestbook

C:\\Python27>dev_appserver.py c:\\GoogleApps\\guestbook

and then I can start my app in the Google App Engine Launcher and hit localhost 8080

How about specifying --host argument? You can find it at the bottom of following doc.

https://developers.google.com/appengine/docs/python/tools/devserver

This might be a little late. But still someone might find it useful.

When ever you go and try changing the port number from 8080 to something else, it will not get updated. So the best option is:

  1. Go to your user directory: eg: C:\\Username
  2. There will be a Google folder. Go inside
  3. Open the file google_appengine_projects.ini
  4. Change your port number from 8080 to whatever you like 8081
  5. Save it and close the file.
  6. Launch the GAE Launcher again and you will find the changes reflected and the app runs without issues.

7: Access the application using: http://localhost:NewPort/

This can be used to change ports both run port and admin port for your individual projects running locally. Hope this helps!

The 8080 portion of your url is a port number. Firefox disables visiting url's of other ports by default. You have to enable them by doing the following: http://blog.christoffer.me/post/2012-02-20-how-to-remove-firefoxs-this-address-is-restricted/

Paraphrasing that website:

  1. Open firefox and visit about:conf
  2. In the Filter box, type in network.security.ports.banned.override
  3. If you can't find such a preference, right click to open up the pop-up menu and pick New and then String
  4. As preference name type network.security.ports.banned.override and 8080 as the value.
  5. Done!

It's likely if this continues to not work that your browser is behaving properly (8080 is a fairly standard port). That means that its a problem with the server and we'd have to do some more debugging.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM