Izinhlelo zokusebenza ngokuvamile zidinga ukunikeza amafayela amile njenge-JavaScript, izithombe, ne-CSS ngaphezu kokusingatha izicelo eziguqukayo. Izinhlelo zokusebenza ezisendaweni evamile zinganikeza amafayela amile asuka kunketho Yefu le-Google njenge-Cloud Storage, ziwanikeze ngokuqondile, noma zisebenzise inethiwekhi yokulethwa kokuqukethwe yenkampani yangaphandle (CDN). Ukusingatha isayithi lakho elimile ku-Google Cloud kungabiza kancane kunokusebenzisa usokhaya ovamile. umhlinzeki, njengoba i-Google Cloud inikeza isigaba samahhala ## Inikeza amafayela kusuka ku-Cloud Storage Isitoreji Samafu singasingatha amafa amile wezinhlelo zokusebenza zewebhu ezinamandla. Izinzuzo zokusebenzisa Isitoreji Samafu esikhundleni sokuphakela ngokuqondile ngohlelo lwakho lokusebenza zifaka: - Isitoreji Samafu empeleni sisebenza njengenethiwekhi yokulethwa kokuqukethwe. Lokhu akudingi ukucushwa okukhethekile ngoba ngokuzenzakalelayo noma yini efundekayo ifakwe kunqolobane kunethiwekhi yomhlaba wonke Yesitoreji Samafu - Ukulayisha kohlelo lwakho lokusebenza kuzoncishiswa ngokukhipha amafa amile ku-Cloud Storage. Ngokuya ngokuthi mangaki amafa amile onawo kanye nemvamisa yokufinyelela, lokhu kungehlisa izindleko zokuqalisa uhlelo lwakho lokusebenza ngenani elibalulekile. - Izindleko zomkhawulokudonsa zokufinyelela okuqukethwe ngokuvamile zingaba zincane nge-Cloud Storage Ungalayisha amafa akho Kusitoreji Samafu ngokusebenzisa i ithuluzi lomugqa womyalo we-gsutil noma i-Cloud Storage API I-Google Cloud Client Library ihlinzeka ngeklayenti le-Go 1.11 elingasho lutho ku-Cloud Storage, ukuze ligcine futhi libuyise idatha nge-Cloud Storage kuhlelo lokusebenza lwe-App Engine Isibonelo sokuphakela ngebhakede Lesitoreji Samafu Lesi sibonelo esilula sidala ibhakede Lesitoreji Samafu futhi silayisha amafa amile kusetshenziswa i-Google Cloud CLI: Dala ibhakede. Kuvamile, kodwa akudingekile, ukuqamba ibhakede lakho nge-ID yephrojekthi yakho. Igama lebhakede kufanele lihluke emhlabeni jikelele gsutil mb gsyour-igama-ibhakede>Setha i-ACL ukuze inikeze ukufinyelela kokufunda ezintweni ezisebhakedeni I-gsutil defacl isetha i-gsyour-bucket-name efundwa esidlangalaleni>Layisha izinto ebhakedeni. I I-rsynccommand iyindlela esheshayo nelula yokulayisha nokubuyekeza amafa. Ungasebenzisa futhi cp gsutil -m rsync -r ./static gsyour-bucket-name>/static Manje usungakwazi ukufinyelela impahla yakho engashintshi nge 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.