2

我第一次尝试在 Google App Engine 上设置 WordPress。我正在关注Google 的教程,当我使用 cmd 在本地启动开发服务器时:

C:\Program Files\Google\google_appengine>dev_appserver.py C:\Development\myApp

我收到以下错误:

google.appengine.api.yaml_errors.EventError: Unknown url handler type.
<URLMap
    auth_fail_action=redirect
    static_dir=None
    secure=default
    http_headers=None
    url=/wp-(.+).php
    static_files=None
    expiration=None
    upload=None
    api_endpoint=None
    script=None
    application_readable=None
    position=None
    login=optional
    mime_type=None
    require_matching_file=None
    >
  in "C:\Development\myApp\app.yaml", line 41, column 2

在教程中复制了“app.yaml”,但添加了正确的应用程序 ID:

application: myApp ID
version: wp
runtime: php
api_version: 1

handlers:
- url: /(.*\.(htm$|html$|css$|js$))
  static_files: wordpress/\1
  upload: wordpress/(.*\.(htm$|html$|css$|js$))
  application_readable: true

- url: /wp-content/(.*\.(ico$|jpg$|png$|gif$))
  static_files: wordpress/wp-content/\1
  upload: wordpress/wp-content/(.*\.(ico$|jpg$|png$|gif$))
  application_readable: true

- url: /(.*\.(ico$|jpg$|png$|gif$))
  static_files: wordpress/\1
  upload: wordpress/(.*\.(ico$|jpg$|png$|gif$))

- url: /wp-admin/(.+)
  script: wordpress/wp-admin/\1
  secure: always

- url: /wp-admin/
  script: wordpress/wp-admin/index.php
  secure: always

- url: /wp-login.php
  script: wordpress/wp-login.php
  secure: always

- url: /wp-cron.php
  script: wordpress/wp-cron.php
  login: admin

- url: /xmlrpc.php
  script: wordpress/xmlrpc.php

- url: /wp-(.+).php
 script: wordpress/wp-\1.php

- url: /(.+)?/?
  script: wordpress/index.php

这是引发错误的行:

url: /wp-(.+).php
     script: wordpress/wp-\1.php

所以,我不知道从这里做什么 - 任何想法都将不胜感激。

谢谢!

4

2 回答 2

4

您需要修复 yaml 标记,在给您带来问题的行之前只有 1 个空格,请在“脚本”一词之前检查:

- url: /wp-(.+).php
 script: wordpress/wp-\1.php

当第二行应该有 2 个空格时,如下所示:

- url: /wp-(.+).php
  script: wordpress/wp-\1.php

我今天也遇到了这个错误,很容易错过。

于 2013-10-08T20:32:42.993 回答
0

我在 SO 上的另一个 Q 上发现了一个不同的问题,但注意到他们的 app.yaml 中缺少该行,所以我将其删除并试一试:它有效!

于 2013-10-07T21:58:51.260 回答