python - Google 应用引擎 dev_appserver.py 问题

标签 python google-app-engine

我刚开始使用 google app engine,我遵循了 google app engine 上的基本 hello world 示例。

https://developers.google.com/appengine/docs/python/gettingstartedpython27/helloworld

在 helloworld 文件夹中创建了这两个文件。

我不想使用 GUI 我更喜欢使用 mac 终端来处理这个应用程序。我想通过终端在我的本地主机 localhost:80 上启动这个应用程序。

要在本地运行我的基本 helloworld 应用程序,我所说的就是

$ dev_appserver.py helloworld .但我得到了这个错误。

Traceback (most recent call last):
  File "/usr/local/bin/dev_appserver.py", line 184, in <module>
    _run_file(__file__, globals())
  File "/usr/local/bin/dev_appserver.py", line 180, in _run_file
    execfile(script_path, globals_)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 727, in <module>
    main()
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 720, in main
    dev_server.start(options)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 554, in start
    options.yaml_files)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 556, in __init__
    module_configuration = ModuleConfiguration(yaml_path)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 82, in __init__
    self._yaml_path)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 271, in _parse_configuration
    with open(configuration_path) as f:
IOError: [Errno 2] No such file or directory: 'helloworld'

我在 helloworld 目录中有两个文件。 应用.yaml

application: your-app-id
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /.*
  script: helloworld.application

和 helloworld.py

import webapp2

class MainPage(webapp2.RequestHandler):

    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.write('Hello, World!')


application = webapp2.WSGIApplication([
    ('/', MainPage),
], debug=True)

最佳答案

安装google cloud sdk后,你运行了吗

gcloud components install app-engine-go

文档在组织方面有点荒谬。我刚开始的时候完全错过了这一点

关于python - Google 应用引擎 dev_appserver.py 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18554364/

相关文章:

python - 在 Google App Engine 上使用 couchdbkit(第 3 方库)

python - 如何导入带变量的文件?

python - 在 numpy 中创建一个特殊矩阵

python - Google App Engine : Reverse Proxy + OpenID, 用户在登录后被重定向到 appspot 域

java - 以编程方式从 Google App Engine 端点方法内部获取基本 url

java - 如何在 Cloud Endpoints 中返回自定义错误代码?

python - 如何在 Python 脚本中存储 Github 的 OAuth token ?

python - 如何将 pdf 文件中的两页合并为一页

python - 如何将 jenkins 作业配置 config.xml 转换为 python 中的 YAML 格式以使用 jenkins-job-builder?

python - google appengine - 如何配置发送和接收电子邮件