我需要app.yaml
和网址管理方面的帮助。我有脚本ting.py
,searchandler.py
和toplawfirms.py
。我首先创建了ting.py
,我在app.yaml
- url: /.*
script: ting.py
,所有其他页面都在ting.py
中声明。但是我认为searchhandler.py
和toplawfirms.py
犯了一个错误,因为它没有让它们成为第二级。现在有办法让app.yaml
只有三个脚本,以便我的app.yaml
看起来像
...
- url: /???
script: searchhandler.py
- url: /???
script: toplawfirms.py
- url: /.*
script: ting.py
...
这样我就可以在脚本中声明所有其他页面了吗?
这就是我现在所拥有的:
application: ting-1
version: 1
runtime: python
api_version: 1
handlers:
- url: /_ah/mail/.+
script: incoming.py
login: admin
- url: /stylesheets
static_dir: stylesheets
- url: /favicon.ico
static_files: static/images/favicon.ico
upload: static/images/favicon.ico
- url: /image
script: toplawfirms.py
- url: /imageupload
script: toplawfirms.py
- url: /imagesave
script: toplawfirms.py
- url: /imageresize
script: toplawfirms.py
- url: /displayimage
script: toplawfirms.py
- url: /histogram
script: toplawfirms.py
- url: /testurlopen
script: toplawfirms.py
- url: /printdb
script: toplawfirms.py
- url: /cropimage
script: toplawfirms.py
- url: /jquerytest
script: toplawfirms.py
- url: /urlopenppp
script: toplawfirms.py
- url: /deleteone
script: toplawfirms.py
- url: /enterppp
script: toplawfirms.py
- url: /saveppp
script: toplawfirms.py
- url: /searchhandler
script: searchhandler.py
- url: /site
script: searchhandler.py
- url: /searchall
script: searchall.py
- url: /.*
script: ting.py
inbound_services:
- mail
答案 0 :(得分:1)
最简单的方法是在ting.py
中创建一个WSGI应用,并为其添加所有网址的所有处理程序。然后删除除/.*
映射之外的所有映射。
答案 1 :(得分:0)
我使用来自不同模块的处理程序。我只是把它放在外面,然后在上面,我可以做任何其他事情:
...
# All other URLs use main.app
- url: /.*
script: main.app
inbound_services:
- xmpp_message
- mail
builtins:
- datastore_admin: on
- remote_api: on
error_handlers:
- file: default_error.html
libraries:
- name: jinja2
version: latest
- name: setuptools
version: latest
- name: markupsafe
version: latest
- name: django
version: latest
- name: PIL
version: latest
- name: webob
version: latest