dev_appserver.py没有这样的文件或目录

时间:2013-08-20 03:10:59

标签: python google-app-engine

我正在尝试启用发送中的电子邮件。所以我需要运行服务器。 我在我的应用程序所在的名为“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'的文件,但Google文档说“dev_appserver.py myapp” 所以我认为'trade'将是myapp名称。我还尝试使用'main.py','main.app','main'来使用dev_appserver.py,但它们都没有用。 我做错了什么?

1 个答案:

答案 0 :(得分:5)

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

dev_appserver.py .

dev_appserver.py ../trade

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

dev_appserver.py trade