我目前正在使用angular-CLI生成的angular4投影來創建項目結構,並且我能夠使用ng-serve服務它並開發並查看更改。現在我想將它移動到我自己的後端,使用谷歌應用程序引擎和webApp2並使用dev_appserver.py app.yaml運行它。目前,我可以通過執行ng-build並從dist文件夾中提供文件來完成這項工作。我想這樣做,所以我可以輕鬆地進行更改,但不必等待每次重建。谷歌上的Angular4和WebApp2應用引擎
0
A
回答
1
您可以在角度上使用環境,以指向您的Python休息服務和另一個環境生產。
例子:
enviroment.ts
export const environment = { production: false, urlServices: 'http://190.52.112.41:8075' };
enviroment.prod.ts
export const environment = { production: true, urlServices: 'http://localhost:8080' };
這樣,你不需要編譯,測試你aplication因爲angular始終會指向你的python應用程序。
0
使用標準的App Engine配置的app.yaml的解決方案:
service: stage
runtime: python27
api_version: 1
threadsafe: true
skip_files:
- ^(?!dist) # Skip any files not in the dist folder
handlers:
# Routing for bundles to serve directly
- url: /((?:inline|main|polyfills|styles|vendor)\.[a-z0-9]+\.bundle\.js)
secure: always
redirect_http_response_code: 301
static_files: dist/\1
upload: dist/.*
# Routing for a prod styles.bundle.css to serve directly
- url: /(styles\.[a-z0-9]+\.bundle\.css)
secure: always
redirect_http_response_code: 301
static_files: dist/\1
upload: dist/.*
# Routing for typedoc, assets and favicon.ico to serve directly
- url: /((?:assets|docs)/.*|favicon\.ico)
secure: always
redirect_http_response_code: 301
static_files: dist/\1
upload: dist/.*
# Any other requests are routed to index.html for angular to handle so we don't need hash URLs
- url: /.*
secure: always
redirect_http_response_code: 301
static_files: dist/index.html
upload: dist/index\.html
http_headers:
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Frame-Options: DENY
尋找任何反饋,我怎麼能做到這一點更好。
相關問題
- 1. 在谷歌應用引擎上使用webapp2的DomainRoute
- 2. 在谷歌應用引擎上使用金字塔與webapp2
- 3. 谷歌應用程序引擎,webapp2,DomainRoute和懶處理程序
- 4. 克-signin2不與webapp2的(谷歌應用程序引擎,users.get_current_user())
- 5. 繼承webapp2的谷歌應用程序引擎錯誤
- 6. 谷歌應用引擎與python webapp2 lazy_gettext錯誤babel
- 7. python谷歌應用程序引擎:Webapp2:身份驗證
- 8. 谷歌應用引擎上的CUPP(pentest)
- 9. Jinja2谷歌應用引擎上的PackageLoader
- 10. 谷歌應用引擎上的Django 1.1
- 11. 谷歌應用引擎上的CMS
- 12. SSL谷歌應用引擎
- 13. 谷歌應用引擎HardDeadlineExceededError
- 14. 谷歌應用引擎
- 15. java.lang.ClassNotFoundException:org.springframework.web.servlet.DispatcherServlet谷歌應用引擎
- 16. 谷歌應用引擎
- 17. 從谷歌應用引擎遷移到谷歌計算引擎
- 18. Codeigniter和谷歌應用引擎
- 19. 谷歌應用程序引擎和Python
- 20. bootstrap和谷歌應用程序引擎
- 21. 谷歌應用程序引擎和.net
- 22. 谷歌應用引擎Django和HTML5
- 23. passlib和谷歌應用引擎
- 24. 進口的,即使我沒有谷歌,應用引擎webapp2的安裝
- 25. django,谷歌應用程序引擎和谷歌驅動器api
- 26. 谷歌雲SQL和谷歌應用程序引擎
- 27. Flask SqlAlchmey在谷歌應用程序引擎和谷歌雲sql
- 28. 谷歌地圖和谷歌應用引擎
- 29. 谷歌應用引擎和谷歌結帳通知錯誤
- 30. 谷歌應用引擎上的Scala的說明和示例
我試過了,但是我的文件沒有上傳 –
對不起,我沒有再使用Angular或Google雲端平臺,所以我不確定發生了什麼問題。兩條建議:確認您在上傳之前構建dist文件('ng build --prod && gcloud app deploy')並嘗試刪除'skip_files:'部分,以便上傳所有內容。 – Rob