Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google app engine 如何在App Engine中映射静态处理程序?_Google App Engine_Handler_Yaml - Fatal编程技术网

Google app engine 如何在App Engine中映射静态处理程序?

Google app engine 如何在App Engine中映射静态处理程序?,google-app-engine,handler,yaml,Google App Engine,Handler,Yaml,我刚刚开始学习如何为App Engine开发,我正在尝试组织我的文件结构,并且我的静态文件位于此层次结构下: 根目录/主题/默认/资源/样式 对于我的css文件和我的js,位于: 根/主题/默认/资产/脚本 当我将文件放入这些文件夹时,我很难让AE提供这些文件。如果我将css和js文件放入: 根/主题/默认/资产 如果我在我的app.yaml中使用以下内容,则我不会将其发送到浏览器: - url: /themes/(.+)/assets/(.+) static_files: themes/\

我刚刚开始学习如何为App Engine开发,我正在尝试组织我的文件结构,并且我的静态文件位于此层次结构下:

根目录/主题/默认/资源/样式

对于我的css文件和我的js,位于:

根/主题/默认/资产/脚本

当我将文件放入这些文件夹时,我很难让AE提供这些文件。如果我将css和js文件放入:

根/主题/默认/资产

如果我在我的app.yaml中使用以下内容,则我不会将其发送到浏览器:

- url: /themes/(.+)/assets/(.+)
  static_files: themes/\1/assets/\2
  upload: themes/(.+)/assets/(.+)
我试过几种方法,但我就是不明白。我的问题是,用我的组织结构编写处理程序以访问这些文件的正确方法是什么


谢谢你的帮助。Thnx

可能是您的正则表达式太贪婪了-请尝试以下操作

- url: /themes/(.+)/assets/(styles|scripts)/(.+)
  static_files: themes/\1/assets/\2/\3
  upload: themes/(.+)/assets/(styles|scripts)/(.+)

除非您试图捕捉一些非常特殊的
404
s,否则我将使用以下内容:

- url: /themes
  static_dir: themes

结果证明,我尝试的所有方法都会奏效(包括上面的答案——所以我增加了它们)。之所以没有,是因为有一个问题,文件夹没有被Git部署,这是一个糟糕的时机,让我觉得是我。一旦文件夹部署完毕,一切都正常工作


再次感谢您的帮助。

出于好奇,为什么要把事情复杂化,而不是简单地使用“/themes”路线?