Static files not serving when uploaded in Google app engine (SDK Go)

Arjun Ajith :

I was trying to use google app engine cloud space. My program is running without any problem in localhost, but when I tries to host it in google app engine, static files are not served. The app.yaml is as follows:

application: myTestApp-nn34322
version: 1
runtime: go
threadsafe: true
api_version: go1

handlers:
- url: /static/css
  static_dir: ../static/css
  mime_type: "text/css"

- url: /static/js
  static_dir: ../static/js
  mime_type: "text/javascript"

- url: /static/images
  static_dir: ../static/images

- url: /.*
  script: _go_app
icza :

You should put every static resources under the same folder where you put your app.yaml file, else they won't get uploaded to AppEngine.

So you should put your static folder next to app.yaml, and then of course the correct path is simply static/xxx, e.g.:

- url: /static/css
  static_dir: static/css
  mime_type: "text/css"

- url: /static/js
  static_dir: static/js
  mime_type: "text/javascript"

- url: /static/images
  static_dir: static/images

Note:

If you intend to use these static files from your Go app too (e.g. you want to read their content), that requires special handling because resources matched by static file patterns will not be copied to the application after uploading (static files are served by separate servers). For details, see Google App Engine Golang no such file or directory. Basically you either have to duplicate the static files, or provide the application_readable option to the static file handler.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How can I use bucket storage to serve static files on google flex/app engine environment?

分類Dev

google app engine datastore Go Query with "in" operator

分類Dev

Google App Engine Go HTTP Post [] byte

分類Dev

Google App Engine Go score counting and saving

分類Dev

Google App Engine:MemcacheまたはStatic変数?

分類Dev

How to get an old Google App Engine SDK version

分類Dev

Google App Engine (Python SDK) - How to catch db exceptions

分類Dev

Express not serving static files correctly for react build

分類Dev

Serving Django static files in Elasticbeanstalk Docker environment

分類Dev

Google App Engine DatastoreのGo-Many関係

分類Dev

Google App Engine Goのメモリ管理

分類Dev

Google App Engine + Go + RESTサービス

分類Dev

Using JSON requests in Google App Engine (Go programming language)

分類Dev

How to setup data fixtures in Google App Engine for Go

分類Dev

Are Google App Engine entity groups locked when writes are not in a transaction

分類Dev

RSA in Google App Engine

分類Dev

google app engine and mongodb

分類Dev

Starting app engine modules in Google App Engine

分類Dev

Resume file downloading with Spring Webflux and static files serving in Spring

分類Dev

Django Channels 2.0 and Daphne: serving static and media files

分類Dev

Google App Engine(Python SDK)-db例外をキャッチする方法

分類Dev

Cloud DatastoreクライアントライブラリとApp Engine Go StandardのApp Engine SDK

分類Dev

Spring boot not serving static content when Jersey REST is included

分類Dev

Google App Engine-GoとPythonの推奨事項?

分類Dev

Go WebappをGoogle App Engineから独立させる

分類Dev

Google App engine-Redislabs Go runtime production error-invalid memory address or nil pointer dereference

分類Dev

Google App Engine:Goの1対多の関係

分類Dev

Go、Google App Engineで外部CSSと(静的)画像を使用する方法

分類Dev

Google App Engine + Go +静的ファイルの提供+設定の問題

Related 関連記事

  1. 1

    How can I use bucket storage to serve static files on google flex/app engine environment?

  2. 2

    google app engine datastore Go Query with "in" operator

  3. 3

    Google App Engine Go HTTP Post [] byte

  4. 4

    Google App Engine Go score counting and saving

  5. 5

    Google App Engine:MemcacheまたはStatic変数?

  6. 6

    How to get an old Google App Engine SDK version

  7. 7

    Google App Engine (Python SDK) - How to catch db exceptions

  8. 8

    Express not serving static files correctly for react build

  9. 9

    Serving Django static files in Elasticbeanstalk Docker environment

  10. 10

    Google App Engine DatastoreのGo-Many関係

  11. 11

    Google App Engine Goのメモリ管理

  12. 12

    Google App Engine + Go + RESTサービス

  13. 13

    Using JSON requests in Google App Engine (Go programming language)

  14. 14

    How to setup data fixtures in Google App Engine for Go

  15. 15

    Are Google App Engine entity groups locked when writes are not in a transaction

  16. 16

    RSA in Google App Engine

  17. 17

    google app engine and mongodb

  18. 18

    Starting app engine modules in Google App Engine

  19. 19

    Resume file downloading with Spring Webflux and static files serving in Spring

  20. 20

    Django Channels 2.0 and Daphne: serving static and media files

  21. 21

    Google App Engine(Python SDK)-db例外をキャッチする方法

  22. 22

    Cloud DatastoreクライアントライブラリとApp Engine Go StandardのApp Engine SDK

  23. 23

    Spring boot not serving static content when Jersey REST is included

  24. 24

    Google App Engine-GoとPythonの推奨事項?

  25. 25

    Go WebappをGoogle App Engineから独立させる

  26. 26

    Google App engine-Redislabs Go runtime production error-invalid memory address or nil pointer dereference

  27. 27

    Google App Engine:Goの1対多の関係

  28. 28

    Go、Google App Engineで外部CSSと(静的)画像を使用する方法

  29. 29

    Google App Engine + Go +静的ファイルの提供+設定の問題

ホットタグ

アーカイブ