angular - 用于 Angular 7 的谷歌云应用程序 yaml
问题描述
我的项目目录看起来像
**demo**
-->
**ui**-->
**dist**-->
**ui**-->
*.html
*.js files
In my app.yaml
runtime: python27
api_version: 1
threadsafe: true`enter code here`
handlers:
- url: /
static_files: dist/\1/index.html
upload: dist/(.*)/(.*)
每当我部署我的应用程序并点击 URL 时,我都会看到 404 无法加载资源:服务器以 404 () 的状态响应除 index.html 之外的所有文件。
任何帮助如何进一步进行将不胜感激。
阅读堆栈溢出相关问题但没有运气
解决方案
在这里我分享我使用的方法。
app.yaml
应该看起来像:
runtime: python27
threadsafe: true
api_version: 1
handlers:
- url: /(.+\.js)
static_files: app/\1
upload: app/(.+\.js)
- url: /(.+\.css)
static_files: app/\1
upload: app/(.+\.css)
- url: /(.+\.png)
static_files: app/\1
upload: app/(.+\.png)
- url: /(.+\.jpg)
static_files: app/\1
upload: app/(.+\.jpg)
- url: /(.+\.svg)
static_files: app/\1
upload: app/(.+\.svg)
- url: /favicon.ico
static_files: app/favicon.ico
upload: app/favicon.ico
- url: /(.+\.json)
static_files: app/\1
upload: app/(.+\.json)
- url: /(.+)
static_files: app/index.html
upload: app/index.html
- url: /
static_files: app/index.html
upload: app/index.html
这些处理程序规则可以优化。在这里,我将它们以每种文件类型的详细形式保存。
文件夹的目录结构deploy
应如下所示:
/deploy
app.yaml
/app => generated by ng build
index.html
...bundles..js
/assets
...
此默认服务将https://YOUR_PROJECT_ID.appspot.com
照常提供。
也许这些链接可以帮助您:
Anoop Sharma在 Google App Engine 上部署 Angular 2/4/6 应用程序
推荐阅读
- swift - 如何从多个 API url 下载图像但跳过无法访问的
- python - 如何查找网络 ID
- tsql - 我有一个要求,我需要在 Azure SQL DW 中将列值动态转换为列标题
- python - 遵循 python googl-style-guide 时避免使用静态成员和方法
- python-3.x - 在 CPLEX 上实施软规则
- linux - Ubuntu / NGINX - 无法更改某些目录和文件的所有权或权限
- swift - 将数据从蓝牙设备转换为可读字符串
- python - 比较具有相同形状但沿轴移动的两条曲线
- java - JVM 搜索 install4j 应用程序的回退
- ssl - 将 Http 更改为 Https 用于 c# Web 应用程序