Solution to Google App Engine, localhost, HTTP Error 403 Forbidden, Python, Django

Finally, after hours of power-googling, I have solved it. It was the damn proxy that made it impossible to try out the app locally. My computer needs a proxy to connect to the outside network, but Python does not really like this. So now I disable the proxy before I start the local google appserver (dev_appserver.py). Working in Ubuntu 14.10 this is the solution.

  • Make a copy of ~/.bashrc and call it .bashrcNoProxy
  • edit the new file, remove the system wide environment proxy settings by adding these rows to the end of the file:
    • unset http_proxy
      unset https_proxy
      unset ftp_proxy
      unset no_proxy
      unset HTTP_PROXY
      unset HTTPS_PROXY
      unset FTP_PROXY
      unset NO_PROXY
  • Run the command ‘source .bashrcNoProxy’ to disable the proxy.
  • Now run dev_appserver.py appengine-try-python-django (last part is of course the name of your app folder)
  • Now you are able to test the app by surfing to localhost:8080

Well, now I know this, and you to. Crap, things are hard when you are not used to it.

My original error message from dev_appserver.py when accessing localhost:8080:

 File "/usr/lib/python2.7/urllib2.py", line 410, in open
 response = meth(req, response)
 File "/usr/lib/python2.7/urllib2.py", line 523, in http_response
 'http', request, response, code, msg, hdrs)
 File "/usr/lib/python2.7/urllib2.py", line 448, in error
 return self._call_chain(*args)
 File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
 result = func(*args)
 File "/usr/lib/python2.7/urllib2.py", line 531, in http_error_default
 raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 403: Forbidden

/Olof

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.