【问题标题】:Static dir in app.yaml with space in dir name, how do I handle this?app.yaml 中的静态目录,目录名称中有空格,我该如何处理?
【发布时间】:2012-08-25 00:22:58
【问题描述】:

我有一个 GAE + webapp2 应用程序,我的 html 中的 href 行出现此错误,

INFO     2012-08-25 00:08:47,461 dev_appserver.py:2891] "GET /components%20copy_files/bootstrap-typeahead.js HTTP/1.1" 404 -
INFO     2012-08-25 00:08:47,470 dev_appserver.py:2891] "GET /components%20copy_files/application.js HTTP/1.1" 404 -

(我有一堆但是..)

问题是我的 html 引用了这个文件夹的 css/js “组件副本文件”

如何在我的 app.yaml 中映射它?我试过了

- url: /components%20copy_files
    static_dir: templates/components%20copy_files

- url: /components copy_files
      static_dir: templates/components copy_files

- url: /components\%20copy_files
      static_dir: templates/components\%20copy_files

但我无法让我的网站加载其 css/js...?提前感谢您的帮助。

另外作为后续问题,如果我从不同的托管服务器移植 html/css/js 并且所有 href 链接和目录都已就位,我如何让 app.yaml/webapp2 路由到所有这些文件..我是否必须在我的 app.yaml 中声明每个静态目录?顺便说一句:我正在移植一个使用 twitter bootstrap(由其他人编写)的项目,但我不想通过他们的代码返回并编辑所有 href,是否有任何快速解决方案可以让这些嵌套资源文件很好地与gae+app.yaml/webapp2?

如果您能提供帮助,非常感谢!

【问题讨论】:

    标签: google-app-engine webapp2


    【解决方案1】:

    正确的配置是:

    - url: /components%20copy_files
      static_dir: templates/components copy_files
    

    【讨论】:

      【解决方案2】:
      - url: /components%20copy_files
        static_dir: you can have whatever name you want here(doesn't have to match the url)
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-08-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-04-02
        • 2016-02-27
        相关资源
        最近更新 更多