简体   繁体   中英

Appengine (Python) “Push to Deploy” app.yaml Location

I have an app with the following file structure

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

Before "Push to Deploy", I deploy my app like this

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

I would like to set up "Push to Deploy" but seems like it requires the app.cfg at the root directory like this.

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

Is there a way to use "Push to Deploy" without moving all the {other .py source files} to root directory?

I'm OK with moving the app.yaml file to root. However, what change in the app.cfg is required?

This is my app.cfg file

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

You should be able to put all of your Python source files in a package (a subdirectory with a __init__.py file in it), then refer to your handlers by their package path.

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

The app.yaml simply uses the path like so:

...
handlers:
- url: /
  script: myapp.main.application

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM