Skip to main content
 首页 » 编程设计

python之更新 GAE python 应用程序的问题

2025年05月04日7zlslch

使用以下命令将我的应用更新为 GAE 时: python appcfg.py 更新/home/tom/workspace/DjangoProject

我收到一条错误消息:

mapping values are not allowed here 
  in "/home/tom/workspace/DjangoProject/app.yaml", line 6, column 9 

这是我的 yaml:

application:myapp 
version:1 
runtime:python 
api_version:1 
 
handlers: 
- url:/ 
  script:home.py 
 
- url:/index\.html 
  script: home.py 
 
- url: /stylesheets 
  static_dir: stylesheets 
 
- url: /(.*\.(gif|png|jpg)) 
  static_files: static/\1 
  upload: static/(.*\.(gif|png|jpg)) 
 
- url: /admin/.* 
  script: admin.py 
  login: admin 
 
- url: /.* 
  script: not_found.py 

谁能帮帮我?

我更改了我的 yaml:

application:myapp 
version:1 
runtime:python 
api_version:1 
handlers 
- url:/ 
  script:home.py 
- url:/index\.html 
  script:home.py 
- url:/stylesheets 
  static_dir:stylesheets 
- url:/(.*\.(gif|png|jpg)) 
  static_files:static/\1 
  upload:static/(.*\.(gif|png|jpg)) 
- url:/admin/.* 
  script:admin.py 
  login:admin 
- url:/.* 
  script:not_found.py 

现在错误消息是:

google.appengine.api.appinfo_errors.MissingURLMapping:在应用程序配置中找不到 URLMap 条目

请您参考如下方法:

冒号后必须有空格。这就是它无法解析您的 app.yaml 的原因。 试试这个

application: myapp 
version: 1 
runtime: python 
api_version: 1 
 
handlers: 
- url: / 
  script: home.py 
 
- url: /index\.html 
  script: home.py 
 
- url: /stylesheets 
  static_dir: stylesheets 
 
- url: /(.*\.(gif|png|jpg)) 
  static_files: static/\1 
  upload: static/(.*\.(gif|png|jpg)) 
 
- url: /admin/.* 
  script: admin.py 
  login: admin 
 
- url: /.* 
  script: not_found.py