在Google App Engine上找不到Angular 6路由 [英] Angular 6 routes not found on Google App Engine

查看:66
本文介绍了在Google App Engine上找不到Angular 6路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Google App Engine上部署了Angular 6应用程序. app.yaml配置如下所示:

I deployed an Angular 6 application on Google App Engine. The app.yaml config looks like that:

runtime: python27
api_version: 1
threadsafe: true

skip_files:
- (?!^dist)

handlers:
- url: /
  static_files: dist/index.html
  upload: dist/index.html

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

一切正常,我可以访问所有内容,直到在路由上重新加载页面或通过路由直接访问网站(例如,myapp.com/route).这样,我会收到一条The requested URL /route was not found on this server错误消息.

Everything works fine and I can access everything till I reload the page on a route or directly access the website by a route (eg. myapp.com/route). Doing that I get a The requested URL /route was not found on this server error message.

推荐答案

更新Flask服务器,以使"/"和"/route"都返回您的角度index.html.这样,当GAE/flask返回内容时,angular将处理路由以显示正确的内容.

Update your flask server so that "/" and "/route" both return your angular index.html. This way angular will handle the routing to display the right content when it's returned by GAE/flask.

这篇关于在Google App Engine上找不到Angular 6路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆