google app引擎:在此服务器上找不到URL / 404错误

时间:2018-12-30 16:27:23

标签: google-app-engine

我有从GitHub Zorya克隆的代码。我刚刚在其中添加了一个www文件夹和一个index.html文件,因为我在某个地方读到该错误是因为没有www目录。

这是我的应用程序结构的样子:

enter image description here

我的app.yaml文件:

runtime: python27
api_version: 1
threadsafe: true
service: default

builtins:
- deferred: on

# Handlers define how to route requests to your application.
 handlers:
 - url: /api/v1/(.*)
  script: main.app

 - url: /tasks/(.*) 
 script: main.app

- url: /
 static_files: build/index.html
 upload: build/index.html

- url: /favicon\.png
 static_files: build/favicon.png
 upload: build/favicon\.png

# unused for now
# - url: /service-worker\.js
#   static_files: build/service-worker.js
#   upload: build/service-worker\.js

 - url: /manifest\.json
  static_files: build/manifest.json
  upload: build/manifest\.json

 - url: /static/(.*)
 static_files: build/static/\1
 upload: build/static/(.*)

 - url: .*
 static_files: build/index.html
 upload: build/index.html


  # here if you want to use them.  See
 # https://developers.google.com/appengine/docs/python/tools/libraries27 for
# a list of libraries included in the SDK.  Third party libs that are *not* 
part
# of the App Engine SDK don't need to be listed here, instead add them to 
your
 # project directory, either as a git submodule or as a plain subdirectory.
#libraries:
#- name: jinja2
  #  version: latest

 libraries:
- name: ssl
  version: latest
 - name: numpy
  version: "1.6.1"

 skip_files:
 - ^\.git$
  - ^\client$
  - ^\venv$

 # needed for dev_appserver.py, tracks too many changes otherwise
- .*/zorya/client

这是我在日志中看到的错误之一:

enter image description here

1 个答案:

答案 0 :(得分:0)

您对/favicon.ico(在注释日志中显示)和/(从日志图像中)的请求都与.*处理程序模式匹配,您已将其配置为服务{ {1}}静态资源。

但是在build/index.html应用程序/服务目录下没有build目录,因此您的静态资源不存在。因此出现404错误。

也许您是说使用zorya而不是www?如果是这样,则应将目录名与处理程序模式中使用的目录名匹配。您可以将build目录重命名为www(不,您不需要使用该确切名称)。

特别是对于favicon错误,您可能希望为build而不是favicon.ico指定处理程序