ਐਪਲੀਕੇਸ਼ਨਾਂ ਨੂੰ ਅਕਸਰ ਗਤੀਸ਼ੀਲ ਬੇਨਤੀਆਂ ਨੂੰ ਸੰਭਾਲਣ ਦੇ ਨਾਲ-ਨਾਲ ਜਾਵਾ ਸਕ੍ਰਿਪਟ, ਚਿੱਤਰ ਅਤੇ CSS ਵਰਗੀਆਂ ਸਥਿਰ ਫਾਈਲਾਂ ਦੀ ਸੇਵਾ ਕਰਨ ਦੀ ਲੋੜ ਹੁੰਦੀ ਹੈ। ਮਿਆਰੀ ਵਾਤਾਵਰਣ ਵਿੱਚ ਐਪਸ ਕਲਾਉਡ ਸਟੋਰੇਜ ਵਰਗੇ Google ਕਲਾਊਡ ਵਿਕਲਪ ਤੋਂ ਸਥਿਰ ਫ਼ਾਈਲਾਂ ਨੂੰ ਸੇਵਾ ਦੇ ਸਕਦੇ ਹਨ, ਉਹਨਾਂ ਨੂੰ ਸਿੱਧੇ ਤੌਰ 'ਤੇ ਸੇਵਾ ਕਰ ਸਕਦੇ ਹਨ, ਜਾਂ ਕਿਸੇ ਤੀਜੀ-ਧਿਰ ਸਮੱਗਰੀ ਡਿਲੀਵਰੀ ਨੈੱਟਵਰਕ (CDN) ਦੀ ਵਰਤੋਂ ਕਰ ਸਕਦੇ ਹਨ। Google Cloud 'ਤੇ ਤੁਹਾਡੀ ਸਥਿਰ ਸਾਈਟ ਦੀ ਮੇਜ਼ਬਾਨੀ ਰਵਾਇਤੀ ਹੋਸਟਿੰਗ ਦੀ ਵਰਤੋਂ ਕਰਨ ਨਾਲੋਂ ਘੱਟ ਖਰਚ ਹੋ ਸਕਦੀ ਹੈ। ਪ੍ਰਦਾਤਾ, ਜਿਵੇਂ ਕਿ ਗੂਗਲ ਕਲਾਉਡ ਇੱਕ ਮੁਫਤ ਟੀਅਰ ਪ੍ਰਦਾਨ ਕਰਦਾ ਹੈ ## ਕਲਾਉਡ ਸਟੋਰੇਜ ਤੋਂ ਫਾਈਲਾਂ ਦੀ ਸੇਵਾ ਕਰਨਾ ਕਲਾਉਡ ਸਟੋਰੇਜ ਗਤੀਸ਼ੀਲ ਵੈੱਬ ਐਪਸ ਲਈ ਸਥਿਰ ਸੰਪਤੀਆਂ ਦੀ ਮੇਜ਼ਬਾਨੀ ਕਰ ਸਕਦੀ ਹੈ। ਤੁਹਾਡੀ ਐਪ ਤੋਂ ਸਿੱਧੇ ਸੇਵਾ ਕਰਨ ਦੀ ਬਜਾਏ ਕਲਾਉਡ ਸਟੋਰੇਜ ਦੀ ਵਰਤੋਂ ਕਰਨ ਦੇ ਲਾਭਾਂ ਵਿੱਚ ਸ਼ਾਮਲ ਹਨ: - ਕਲਾਉਡ ਸਟੋਰੇਜ ਜ਼ਰੂਰੀ ਤੌਰ 'ਤੇ ਸਮੱਗਰੀ ਡਿਲੀਵਰੀ ਨੈੱਟਵਰਕ ਦੇ ਤੌਰ 'ਤੇ ਕੰਮ ਕਰਦੀ ਹੈ। ਇਸ ਲਈ ਕਿਸੇ ਵਿਸ਼ੇਸ਼ ਸੰਰਚਨਾ ਦੀ ਲੋੜ ਨਹੀਂ ਹੈ ਕਿਉਂਕਿ ਮੂਲ ਰੂਪ ਵਿੱਚ ਕੋਈ ਵੀ ਪੜ੍ਹਨਯੋਗ ਵਸਤੂ ਗਲੋਬਲ ਕਲਾਊਡ ਸਟੋਰੇਜ ਨੈੱਟਵਰਕ ਵਿੱਚ ਕੈਸ਼ ਕੀਤੀ ਜਾਂਦੀ ਹੈ। - ਕਲਾਉਡ ਸਟੋਰੇਜ ਵਿੱਚ ਸਰਵਿੰਗ ਸਥਿਰ ਸੰਪਤੀਆਂ ਨੂੰ ਆਫਲੋਡ ਕਰਕੇ ਤੁਹਾਡੇ ਐਪ ਦਾ ਲੋਡ ਘਟਾਇਆ ਜਾਵੇਗਾ। ਤੁਹਾਡੇ ਕੋਲ ਕਿੰਨੀਆਂ ਸਥਿਰ ਸੰਪਤੀਆਂ ਹਨ ਅਤੇ ਪਹੁੰਚ ਦੀ ਬਾਰੰਬਾਰਤਾ 'ਤੇ ਨਿਰਭਰ ਕਰਦੇ ਹੋਏ, ਇਹ ਤੁਹਾਡੇ ਐਪ ਨੂੰ ਚਲਾਉਣ ਦੀ ਲਾਗਤ ਨੂੰ ਇੱਕ ਮਹੱਤਵਪੂਰਨ ਰਕਮ ਦੁਆਰਾ ਘਟਾ ਸਕਦਾ ਹੈ - ਕਲਾਉਡ ਸਟੋਰੇਜ ਨਾਲ ਸਮੱਗਰੀ ਨੂੰ ਐਕਸੈਸ ਕਰਨ ਲਈ ਬੈਂਡਵਿਡਥ ਖਰਚੇ ਅਕਸਰ ਘੱਟ ਹੋ ਸਕਦੇ ਹਨ ਤੁਸੀਂ ਆਪਣੀ ਸੰਪਤੀਆਂ ਨੂੰ ਕਲਾਉਡ ਸਟੋਰੇਜ 'ਤੇ ਅਪਲੋਡ ਕਰ ਸਕਦੇ ਹੋ gsutil ਕਮਾਂਡ ਲਾਈਨ ਟੂਲ ਜਾਂ ਕਲਾਉਡ ਸਟੋਰੇਜ API Google ਕਲਾਉਡ ਕਲਾਇੰਟ ਲਾਇਬ੍ਰੇਰੀ ਕਲਾਉਡ ਸਟੋਰੇਜ ਨੂੰ ਇੱਕ ਮੁਹਾਵਰੇ ਵਾਲਾ Go 1.11 ਕਲਾਇੰਟ ਪ੍ਰਦਾਨ ਕਰਦੀ ਹੈ, ਇੱਕ ਐਪ ਇੰਜਨ ਐਪ ਵਿੱਚ ਕਲਾਉਡ ਸਟੋਰੇਜ ਨਾਲ ਡੇਟਾ ਨੂੰ ਸਟੋਰ ਕਰਨ ਅਤੇ ਮੁੜ ਪ੍ਰਾਪਤ ਕਰਨ ਲਈ ਕਲਾਊਡ ਸਟੋਰੇਜ ਬਾਲਟੀ ਤੋਂ ਸੇਵਾ ਕਰਨ ਦੀ ਉਦਾਹਰਨ ਇਹ ਸਧਾਰਨ ਉਦਾਹਰਨ ਇੱਕ ਕਲਾਊਡ ਸਟੋਰੇਜ ਬਾਲਟੀ ਬਣਾਉਂਦਾ ਹੈ ਅਤੇ Google ਕਲਾਊਡ CLI ਦੀ ਵਰਤੋਂ ਕਰਕੇ ਸਥਿਰ ਸੰਪਤੀਆਂ ਨੂੰ ਅੱਪਲੋਡ ਕਰਦਾ ਹੈ: ਇੱਕ ਬਾਲਟੀ ਬਣਾਓ. ਆਪਣੀ ਬਾਲਟੀ ਦਾ ਨਾਮ ਤੁਹਾਡੀ ਪ੍ਰੋਜੈਕਟ ਆਈ.ਡੀ. ਦੇ ਬਾਅਦ ਰੱਖਣਾ ਆਮ ਹੈ, ਪਰ ਲੋੜੀਂਦਾ ਨਹੀਂ ਹੈ। ਬਾਲਟੀ ਦਾ ਨਾਮ ਵਿਸ਼ਵ ਪੱਧਰ 'ਤੇ ਵਿਲੱਖਣ ਹੋਣਾ ਚਾਹੀਦਾ ਹੈ gsutil mb gsyour-ਬਾਲਟੀ-ਨਾਮ>ਬਾਲਟੀ ਵਿੱਚ ਆਈਟਮਾਂ ਨੂੰ ਪੜ੍ਹਨ ਦੀ ਪਹੁੰਚ ਦੇਣ ਲਈ ACL ਨੂੰ ਸੈੱਟ ਕਰੋ gsutil defacl ਜਨਤਕ-ਪੜ੍ਹਿਆ ਗਿਆ gsyour-bucket-name>ਸੈੱਟ ਕਰੋ ਆਈਟਮਾਂ ਨੂੰ ਬਾਲਟੀ ਵਿੱਚ ਅੱਪਲੋਡ ਕਰੋ। ਦ rsynccommand ਆਮ ਤੌਰ 'ਤੇ ਸੰਪਤੀਆਂ ਨੂੰ ਅੱਪਲੋਡ ਕਰਨ ਅਤੇ ਅੱਪਡੇਟ ਕਰਨ ਦਾ ਸਭ ਤੋਂ ਤੇਜ਼ ਅਤੇ ਆਸਾਨ ਤਰੀਕਾ ਹੈ। ਤੁਸੀਂ ਵੀ ਵਰਤ ਸਕਦੇ ਹੋ cp gsutil -m rsync -r ./static gsyour-bucket-name>/static ਤੁਸੀਂ ਹੁਣ ਆਪਣੀ ਸਥਿਰ ਸੰਪਤੀਆਂ ਤੱਕ ਪਹੁੰਚ ਕਰ ਸਕਦੇ ਹੋ httpsstorage.googleapis.com//static For more details on how to use Cloud Storage to serve static assets, including how to serve from a custom domain name, refer to How to Host a Static Website Serving files from other Google Cloud services You also have the option of using Cloud CDN or other Google Cloud storage services ## Serving files directly from your app To serve static files for Go 1.11 in the standard environment, you define the handlers in your app.yaml file using either the static_dir or static_files elements The content in the static files or static directories are unaffected by the scaling settings in your app.yaml file. Requests to static files or static directories are handled by the App Engine infrastructure directly, and do not reach the language runtime of the application Configuring your static file handlers To configure your app to serve the ./public directory from the /static URL, you define a handler in your app.yaml file The following demonstrates how to serve the static files of a sample app's ./public directory. The template for this app's index.html page instructs the browser to load the main.css file, for example: /css/main.css"> The ./public directory is defined in the static_dir element of the project's app.yaml file: handlers: - url: /favicon\.ico static_files: favicon.ico upload: favicon\.ico - url: /static static_dir: public - url:secure: always redirect_http_response_code: 301 script: auto The handlers section in the above example handles three URL patterns: The /favicon.icohandler maps a request specifically for /favicon.icoto a file named favicon.icoin the app's root directory The /statichandler maps requests for URLs that start with /static. When App Engine receives a request for a URL beginning with /static, it maps the remainder of the path to files in the ./publicdirectory. If an appropriate file is found in the directory, the contents of that file are returned to the client The handler matches all other URLs and directs them to your app URL path patterns are tested in the order they appear in app.yaml, therefore the pattern for your static files should be defined before the pattern For more information, see the app.yaml reference ## Serving from a third-party content delivery network You can use any external third-party CDN to serve your static files and cache dynamic requests but your app might experience increased latency and cost For improved performance, you should use a third-party CDN that supports CDN Interconnect.