1

我正在尝试在开发中启用发送电子邮件。所以我需要运行服务器。我在我的应用程序所在的名为“trade”的目录中。(参见 pwd 和 ls)

Kenzos-MacBook-Pro:trade kenzotakahashi$ pwd
/Users/kenzotakahashi/desktop/main/WebDevelopment/project/trade
Kenzos-MacBook-Pro:trade kenzotakahashi$ ls
app.yaml    main.pyc    model.pyc   util.py
main.py     model.py    templates   util.pyc

但我得到了这个错误。

Kenzos-MacBook-Pro:trade kenzotakahashi$ dev_appserver.py trade
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 "/Users/kenzotakahashi/Desktop/main/WebDevelopment/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 727, in <module>
    main()
  File "/Users/kenzotakahashi/Desktop/main/WebDevelopment/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 "/Users/kenzotakahashi/Desktop/main/WebDevelopment/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 "/Users/kenzotakahashi/Desktop/main/WebDevelopment/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 "/Users/kenzotakahashi/Desktop/main/WebDevelopment/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 "/Users/kenzotakahashi/Desktop/main/WebDevelopment/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: 'trade'
Kenzos-MacBook-Pro:trade kenzotakahashi$ 

这是我的 app.yaml

application: trade
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /static
  static_dir: static

- url: /.*
  script: main.app

libraries:
- name: jinja2
  version: latest

- name: PIL
  version: "1.1.7"

我知道没有名为“trade”的文件,但谷歌文档说“dev_appserver.py myapp”所以我认为“trade”将是 myapp 名称。我还尝试了带有'main.py'、'main.app'、'main'的dev_appserver.py,但它们都不起作用。我究竟做错了什么?

4

1 回答 1

5

运行时需要指定路径dev_appserver.py。如果您从目录内部运行应用服务器,则trade可以运行

dev_appserver.py .

或者

dev_appserver.py ../trade

运行它的另一种方法是cd ..让你在包含trade然后运行的目录中

dev_appserver.py trade
于 2013-08-20T04:08:31.983 回答