我可以使用Angular 2創建基本的前端應用程序,並且可以使用python在Google App引擎上創建帶有端點的後端。然而,我似乎無法弄清楚如何將這兩者結合在一起並將其部署到雲SDK中。將基本的Angular 2應用程序部署到Google App Engine
這裏是一個基本的例子,我甚至不能在GAE上託管一個簡單的angular2應用程序而沒有後端調用。在使用angular2 CLI構建後,我已經拿到了dist文件夾,並嘗試用app.yaml文件連接到它。它似乎可以在瀏覽器開發者(dev_appserver.py app.yaml)中工作,儘管我在SDK中發現了一些404錯誤,並且發現GET請求會處理我的index.html文件。然後,我創建一個空白index.yaml文件,並嘗試部署它,但在appspot.com位置得到一個404錯誤。這是app.yaml文件:
application:
version:
runtime: python27
threadsafe: true
api_version: 1
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: (.*)/
static_files: dist\1/index.html
upload: dist
- url: (.*)
static_files: dist\1
upload: dist
我真的不知道我在做什麼錯。我是否需要某種main.application python後端連接到dist文件或?我是否需要包含來自Angular2的節點模塊或其他類型或文件?任何幫助將大量讚賞!謝謝
目前爲止最好的答案。如果我找到並改進,我會回來。謝謝 –
@Rob我會將此設置爲接受的答案。你有沒有將這個或任何其他類型的[sever-side rendering](https://github.com/clbond/angular-ssr)加入到部署中? – Nicholas
不,我在登錄後創建一個web應用程序,所以我並不擔心搜索引擎。 – Rob