【问题标题】:Google app engine css not found/deployed未找到/部署 Google 应用引擎 css
【发布时间】:2017-05-08 01:56:15
【问题描述】:

我有以下 app.yaml + 文件结构:

css 文件不断给我 404:

我在 app.yaml 中尝试了不同的文件结构和 static_dir 和 static_files,没有任何效果...

想法?

【问题讨论】:

    标签: google-app-engine


    【解决方案1】:

    根据当前文件结构和您的 app.yaml 配置,您的 css 文件必须在相对于您定义的 url 处理程序的 html 中引用:例如 /css/static.css

    考虑到这一点,static_dir 必须正确定义并且相对于您的app.yaml 的位置,应该是code/public/css不是 /code/public/css注意你放在那里的前导斜杠

    handlers:
    - url: /css
      static_dir: code/public/css
    

    如果你想要完整的路径在你的 html 中,你的配置文件必须稍微调整一下:

    handlers:
    - url: /code/public/css
      static_dir: code/public/css
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-11-12
      • 2011-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-06
      • 2015-02-11
      • 1970-01-01
      相关资源
      最近更新 更多