Ich benutze derzeit ein Angular4 projiziert von angular-CLI generiert, um die Projektstruktur zu erstellen, und ich konnte es mit ng-dienen dienen und entwickeln und sehen Änderungen. Jetzt möchte ich es in meine eigene Backend gehostet werden, mit Google App Engine und WebApp2 und führen Sie es mit dev_appserver.py app.yaml. Zurzeit kann ich es nur mit einem ng-build ausführen und die Dateien aus dem Ordner dist bereitstellen. Ich möchte es so machen, dass ich leicht Änderungen vornehmen kann, aber nicht warten muss, bis es jedes Mal neu aufgebaut wird.Angular4 und WebApp2 auf Google App Engine
0
A
Antwort
1
Sie können Umgebung auf angular verwenden, um Sie Python Rest Service und eine andere Umgebung auf die Produktion zu zeigen.
Beispiel:
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' };
Auf diese Weise brauchen Sie nicht zu kompilieren Sie zu testen aplication weil eckig wird immer auf Sie Python-App verwiesen.
0
Eine app.yaml Lösung unter Verwendung der Standard-App Engine config:
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
Suchen Sie für jedes Feedback, wie ich das besser machen könnte.
Verwandte Themen
- 1. PATCH Methode Handler auf Google App Engine webapp2
- 2. Django vs webapp2 auf App Engine
- 3. Google App Engine Launcher (Python) - ImportError: Kein Modul namens webapp2
- 4. E-Mail von python webapp2 senden Google App Engine
- 5. Testen der lokalen Einheit für Google App Engine + Python WebApp2
- 6. Google App Engine Anmeldung NodeJS
- 7. Python Google App Engine Importfehler
- 8. Google App Engine dev_appserver.py Probleme
- 9. Python-Anwendungsfehler bei Google App Engine
- 10. Google App Engine: Art Fehler
- 11. Benutzerinfo mit OAuth mit Google App Engine
- 12. Import über Module in Google App Engine
- 13. Google Prediction API mit Google App Engine
- 14. Google App Engine und dos.xml
- 15. Google App Engine und CORS
- 16. Google App Engine auf Silverlight
- 17. Google App Engine PIL Unterstützung
- 18. Google App Engine und Paging
- 19. Symfony-App auf Google App-Engine bereitstellen
- 20. , wie Dateien mit python27 App Engine webapp2 Rahmen organisieren
- 21. Google App Engine-Kompatibilitätsschicht
- 22. Google App Engine-Datenspeichercodierung?
- 23. Google App Engine ThreadSafe
- 24. App Engine + Google Dokumente
- 25. Google App Engine-Anforderungsstatus
- 26. Google App Engine + Validierung
- 27. Google App Engine im Editor eingerichtet
- 28. Google App Engine & Google Storage
- 29. Google App Engine APNS
- 30. Google App Engine-Umleitungsproblem
Ich habe das versucht, aber keine meiner Dateien hochgeladen –
Sorry, ich benutze weder Angular noch Google Cloud Platform mehr, also bin ich mir nicht sicher, was schief läuft. Zwei Vorschläge: Vergewissern Sie sich, dass Sie die dist-Dateien vor dem Hochladen erstellen ('ng build --prod && gcloud app deploy') und versuchen Sie den Abschnitt' skip_files: 'zu entfernen, damit alles hochgeladen wird. – Rob