0

我有一个具有以下文件结构的应用程序

app
├── src 
│    ├── app.yaml
│    ├── {other}
│    ├── {.py source}
│    └── {files}
├── {{other}}
├── {{meta}}
└── {{data}}

在“推送部署”之前,我像这样部署我的应用程序

cd app/; appcfg.py --oauth2 update src

我想设置“推送部署”,但似乎它需要像这样在根目录中的 app.cfg。

app
├── app.yaml
├── {other}
├── {.py source}
├── {files}
├── {{other}}
├── {{meta}}
└── {{data}}

有没有办法在不将所有 {other .py source files} 移动到根目录的情况下使用“Push to Deploy”?

我可以将 app.yaml 文件移至根目录。但是,需要对 app.cfg 进行哪些更改?

这是我的app.cfg文件

application: myApp
version: v1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /
  script: main.application

- url: /tasks/.*
  script: tasks.Update.app
  login: admin

- url: /favicon.ico
  static_files: resources/images/static/favicon.ico
  upload: resources/images/static/favicon.ico

- url: /redirect/.*
  script: Redirect.app
4

1 回答 1

0

您应该能够将所有 Python 源文件放在一个包中(一个包含__init__.py文件的子目录),然后通过包路径引用您的处理程序。

app
-- app.yaml
-- myapp
   -- __init__.py
   -- main.py
   ...

app.yaml简单地使用这样的路径:

...
handlers:
- url: /
  script: myapp.main.application
于 2014-09-10T19:08:19.103 回答