如何清理app.yaml,只留下每个脚本的首页?

时间:2011-11-11 00:31:46

标签: python google-app-engine

我需要app.yaml和网址管理方面的帮助。我有脚本ting.pysearchandler.pytoplawfirms.py。我首先创建了ting.py,我在app.yaml

- url: /.*
  script: ting.py

,所有其他页面都在ting.py中声明。但是我认为searchhandler.pytoplawfirms.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

2 个答案:

答案 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