I am watching one tutorial to get a basic web app saying "hello, world" But for some reason I don't understand, I am getting this "The localhost page isn’t working localhost is currently unable to handle this request."
This is what I did. 1. I installed Google App Engine SDK for python. 2. I created two files like this:
main.py
import webapp2
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('Hello, World!')
app = webapp2.WSGIApplication([
('/', MainPage),
], debug=True)
app.yaml
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /.*
script: helloworld.app
I didnt write these. These were given in google app engine website.
and I tried two different methods to run it.
- Using terminal in the folder where the two files are:
I used this command: dev_appserver.py . and this is what I get:
INFO 2016-04-02 04:28:02,071 sdk_update_checker.py:229] Checking for updates to the SDK.
INFO 2016-04-02 04:28:02,949 sdk_update_checker.py:257] The SDK is up to date.
INFO 2016-04-02 04:28:02,982 api_server.py:205] Starting API server at: http://localhost:50345
INFO 2016-04-02 04:28:02,988 dispatcher.py:197] Starting module "default" running at: http://localhost:8080
INFO 2016-04-02 04:28:02,989 admin_server.py:116] Starting admin server at: http://localhost:8000
and when I enter "http://localhost:8000" on chrome, I get this error msg: "The localhost page isn’t working localhost is currently unable to handle this request."
and this is the error msg I get on terminal
ERROR 2016-04-02 04:43:47,109 wsgi.py:263]
Traceback (most recent call last):
File "/Applications/http://ift.tt/1diVhQN", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/Applications/http://ift.tt/1diVhQN", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/Applications/http://ift.tt/1diVhQN", line 85, in LoadObject
obj = __import__(path[0])
ImportError: No module named helloworld
INFO 2016-04-02 04:43:47,114 module.py:787] default: "GET / HTTP/1.1" 500 -
ERROR 2016-04-02 04:43:47,602 wsgi.py:263]
Traceback (most recent call last):
File "/Applications/http://ift.tt/1diVhQN", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/Applications/http://ift.tt/1diVhQN", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/Applications/http://ift.tt/1diVhQN", line 85, in LoadObject
obj = __import__(path[0])
ImportError: No module named helloworld
INFO 2016-04-02 04:43:47,606 module.py:787] default: "GET / HTTP/1.1" 500 -
- Using google app engine launcher I created a new application and this gave me all the files I needed. So I just ran it. It shows me a port number, and when I tried that on chrome, "http://localhost:8000" I get the same error as the first msg.
What is it that I am doing wrong? Thank you.
Aucun commentaire:
Enregistrer un commentaire