Skip to main content
 首页 » 编程设计

python之AppEngine 功能在本地开发服务器上工作,但在实时网络服务器上不工作

2025年05月04日11tintown

我已经设置了一个 AppEngine 帐户来托管基于 WorldKit 的 map 项目 http://worldkit.org/我已经让它几乎 工作了,但我无法工作的最后一件事是 map 注释功能,这是我希望实现的很大一部分。起初,我认为这可能是因为 WorldKit 下载附带了一些 PHP 脚本,而且我知道 GAE 不托管 PHP,但我一直在系统地从默认包中删除部分,直到我剩下只有 .html、.css、.xml、.js、图像文件和用作主要应用程序的单个 .swf。奇怪的是注释在使用本地开发服务器时可以完美地工作,但是当我实时部署它时, map 显示正常,只是没有注释。注释是通过 GeoRSS 提要提供给应用程序的,目前我将其作为静态只读文件提供,但我可能会在未来看到实时更新它。这是我的 app.yaml

application: parallelworldsmaps 
version: 1 
runtime: python 
api_version: 1 
 
default_expiration: "30d" 
 
handlers: 
 
- url: /(.*\.css) 
  mime_type: text/css 
  static_files: static/\1 
  upload: static/(.*\.css) 
 
- url: /(.*\.html) 
  mime_type: text/html 
  static_files: static/\1 
  upload: static/(.*\.html) 
  expiration: "1h" 
 
- url: /(.*\.ico) 
  mime_type: image/x-icon 
  static_files: static/\1 
  upload: static/(.*\.ico) 
  expiration: "7d" 
 
- url: /(.*\.js) 
  mime_type: text/javascript 
  static_files: static/\1 
  upload: static/(.*\.js) 
 
- url: /(.*\.json) 
  mime_type: application/json 
  static_files: static/\1 
  upload: static/(.*\.json) 
  expiration: "1h" 
 
- url: /(.*\.m4v) 
  mime_type: video/m4v 
  static_files: static/\1 
  upload: static/(.*\.m4v) 
 
- url: /(.*\.mp4) 
  mime_type: video/mp4 
  static_files: static/\1 
  upload: static/(.*\.mp4) 
 
- url: /(.*\.(ogg|oga)) 
  mime_type: audio/ogg 
  static_files: static/\1 
  upload: static/(.*\.(ogg|oga)) 
 
- url: /(.*\.ogv) 
  mime_type: video/ogg 
  static_files: static/\1 
  upload: static/(.*\.ogv) 
 
- url: /(.*\.otf) 
  mime_type: font/opentype 
  static_files: static/\1 
  upload: static/(.*\.otf) 
 
- url: /(.*\.rss) 
  mime_type: application/rss+xml 
  static_files: static/\1 
  upload: static/(.*\.rss) 
  expiration: "1h" 
 
- url: /(.*\.(svg|svgz)) 
  mime_type: images/svg+xml 
  static_files: static/\1 
  upload: static/(.*\.(svg|svgz)) 
 
- url: /(.*\.swf) 
  mime_type: application/x-shockwave-flash 
  static_files: static/\1 
  upload: static/(.*\.swf) 
 
- url: /(.*\.ttf) 
  mime_type: font/truetype 
  static_files: static/\1 
  upload: static/(.*\.ttf) 
 
- url: /(.*\.txt) 
  mime_type: text/plain 
  static_files: static/\1 
  upload: static/(.*\.txt) 
 
- url: /(.*\.webm) 
  mime_type: video/webm 
  static_files: static/\1 
  upload: static/(.*\.webm) 
 
- url: /(.*\.xml) 
  mime_type: application/xml 
  static_files: static/\1 
  upload: static/(.*\.xml) 
  expiration: "1h" 
 
# image files 
- url: /(.*\.(bmp|gif|ico|jpeg|jpg|png)) 
  static_files: static/\1 
  upload: static/(.*\.(bmp|gif|ico|jpeg|jpg|png)) 
 
# audio files 
- url: /(.*\.(mid|midi|mp3|wav)) 
  static_files: static/\1 
  upload: static/(.*\.(mid|midi|mp3|wav))   
 
# windows files 
- url: /(.*\.(doc|exe|ppt|rtf|xls)) 
  static_files: static/\1 
  upload: static/(.*\.(doc|exe|ppt|rtf|xls)) 
 
# compressed files 
- url: /(.*\.(bz2|gz|rar|tar|tgz|zip)) 
  static_files: static/\1 
  upload: static/(.*\.(bz2|gz|rar|tar|tgz|zip)) 
 
# index files 
- url: /(.+)/ 
  static_files: static/\1/index.html 
  upload: static/(.+)/index.html 
  expiration: "15m" 
 
- url: /(.+) 
  static_files: static/\1/index.html 
  upload: static/(.+)/index.html 
  expiration: "15m" 
 
# site root 
- url: / 
  static_files: static/index.html 
  upload: static/index.html 
  expiration: "15m" 
 
- url: / 
  static_dir: static 

我所有的静态文件都包含在“静态”目录的子文件夹中。为了更好地了解应用程序的工作原理,.swf 对象访问它用来渲染 map 的图像文件。然后它访问 rss 提要以呈现注释,我在静态 xml 文件中创建了注释并将其放置在与 .swf 相同的目录中。 rss 提要包含坐标、标题、描述和用作 map 标记的图标。所有 map 图 block 都正确显示,但没有任何注释显示正确。根据在本地重现此内容的尝试,这很可能意味着 .swf 无法访问位于同一文件夹中的 .xml 文件。我不确定我还能提供哪些其他信息,但也许是文件没有正确上传,或者是否有奇怪的权限阻止了某些事情?它在开发服务器上运行但在真实服务器上运行却不正常,这很奇怪也很令人沮丧。

请您参考如下方法:

这是关于 how use and read the log files for GAE 的技术文章的链接- 当我们从开发转移到生产时,我们也遇到了神秘的权限问题,通过使用详细的日志记录,我们能够解决这个问题。