gpt4 book ai didi

google-app-engine - 未找到处理程序引用的静态文件 : index. html

转载 作者:行者123 更新时间:2023-12-04 02:00:43 25 4
gpt4 key购买 nike

部署我的第一个应用引擎应用程序后,我收到 Static file referenced by handler not found: index.html 作为日志中的错误。这是我的 yaml 文件:

application: section-14
version: v1
api_version: 1
runtime: python27
threadsafe: yes

handlers:
- url: /bower_components
static_dir: bower_components
- url: /general
static_dir: general
- url: /projects
static_dir: projects
- url: /js
static_dir: js
- url: /styles
static_dir: styles
- url: /elements
static_dir: elements
- url: /images
static_dir: images

#here's the problem
- url: /
static_files: index.html
upload: /
#------------------

- url: /elements.html
static_files: elements.html
upload: /

我可以毫无问题地访问任何其他目录和位于这些目录中的文件。此外,如果您查看 index 条目下方,则 elements.html 路由也有效。

我注意到在其他项目中人们正在定义一个 /static 目录。这是要求吗?我的本地环境为这个应用程序提供服务,没有任何问题。

最佳答案

命名目录 static 不是必需的。我这样做是因为它使布局的重要性显而易见(至少对我而言)。

这是我的一个应用程序中的一个 app.yaml 片段,它有一个静态主页和静态 Assets 。

handlers:
- url: /style/
static_dir: static/style
- url: /js/
static_dir: static/js
- url: /favicon.ico
static_files: static/favicon.ico
upload: static/favicon.ico
mime_type: image/x-icon
- url: /.+
script: main.app
- url: /
static_files: static/index.html
upload: static/index.html

顺序很重要,因为使用 /.+ 而不是 /.* 对于后者,对 / 的请求将被路由到 main.app
编辑添加:具有静态 favicon.ico 的 url 映射对于防止请求被路由到您的应用程序很有用,因为这会导致 App Engine 在不需要实例时启动一个实例。

关于google-app-engine - 未找到处理程序引用的静态文件 : index. html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31482884/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com