0

現在、angular-CLIで生成されたprojection4を使用してプロジェクト構造を作成しています。これをng-serveを使用して提供し、変更を確認しました。今私は自分のバックエンドでホストされているgoogleアプリエンジンとwebApp2を使ってdev_appserver.py app.yamlを使って実行したいと思っています。現在、私が動作させる唯一の方法は、ng-buildを行い、distフォルダからファイルを提供することです。私は簡単に変更を加えることができますが、毎回それを再構築するのを待つ必要はありません。GoogleアプリケーションエンジンのAngular4とWebApp2

答えて

1

あなたはpython rest serviceと別の環境をプロダクションに向けるために、環境に角度を付けることができます。

例:

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をテストするためにコンパイルする必要がいけません角は常にあなたに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 

+0

私はこれを試しましたが、私のファイルはアップロードされていません –

+0

申し訳ありませんが、私はAngularもGoogle Cloud Platformも使用していません。 2つの提案:アップロードする前にdistファイルをビルドしていることを確認し( 'ng build --prod && gcloud app deploy')、' skip_files: 'セクションを削除してすべてがアップロードされるようにしてください。 – Rob

関連する問題