我正在看一个教程,以获得一个基本的Web应用程序说“你好,世界” 但由于某种原因,我不明白,我得到这个 “本地主机页面不工作 本地主机当前无法处理这个请求。”基本的网络应用程序说“你好,世界。”
这就是我所做的。 1.我安装了用于python的Google App Engine SDK。 2.我创建了两个文件是这样的:
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
我没有写这些。这些是在谷歌应用程序引擎网站给出的。
我尝试了两种不同的方法来运行它。
- 其中两个文件夹中使用终端 :
我用这个命令:dev_appserver.py。 ,这就是我得到:
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
,当我在Chrome中输入“http://localhost:8000”,我得到这个错误信息: “localhost的页面不工作 本地主机是目前无法处理此请求。 “
,这是错误味精我得到的终端
ERROR 2016-04-02 04:43:47,109 wsgi.py:263]
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", 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/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", 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 -
- 使用谷歌应用程序引擎启动 我创建了一个新的应用程序,这给了我我需要的所有文件。 所以我就跑了。 它显示我一个端口号,当我试图在铬上, “http://localhost:8000” 我得到与第一个味精相同的错误。
这是什么,我做错了? 谢谢。
你有没有试过http:// localhost:8080? – Ook
@Ook是的,我已经尝试过,并没有奏效。 – Nayana