【发布时间】:2013-11-16 15:21:12
【问题描述】:
我正在设置一个新的 GAE 项目,但我无法让子目录中的脚本正常工作。
编辑:如果我去localhost:8080/testing_desc.html 我没有任何错误,只是一个空白页面(查看源也是空白的)。我的根目录中的脚本正常工作。根目录和子目录中都有一个__init__.py。
Python 脚本示例(“/testing/testing_desc.py”):
import webapp2 as webapp
class DescTstPage(webapp.RequestHandler):
def get(self):
html = 'This should work.'
self.response.out.write(html)
app = webapp.WSGIApplication([('/.*', DescTstPage)], debug=True)
app.yaml:
application: blah
version: blah
runtime: python27
api_version: 1
default_expiration: "5d 12h"
threadsafe: false
libraries:
- name: webapp2
version: latest
handlers:
- url: / <-- This one works
script: main.app
- url: /index.html <-- This does NOT work (??)
script: main.app
- url: /(.*?)_desc.html <-- Also does NOT work
script: \1/\1_desc.app
#file not found
- url: /.*
script: file_not_found.app
我也尝试过更简单的 yaml 版本:
-url: /testing_desc.html
script: /testing/testing_desc.app
【问题讨论】:
-
您尝试过更改处理程序的顺序吗?把更具体的放在首位? (只是猜测)
-
我通过将
main.py从app = webapp.WSGIApplication([('/', DescTstPage)], debug=True)更改为app = webapp.WSGIApplication([('/.*', DescTstPage)], debug=True)来使/index.html正常工作
标签: python google-app-engine wsgi webapp2 app.yaml