CSS File Not Updating on Deploy (Google AppEngine)

后端 未结 12 1771
既然无缘
既然无缘 2020-12-09 03:39

I pushed a new version of my website, but now the CSS and static images are not deploying properly.

Here is the messed up page: http://www.gaiagps.com

Appeng

相关标签:
12条回答
  • 2020-12-09 03:56

    For new people coming to this old questions/set of answers I wanted to give an updated answer. I think in 2018-19 the following information will probably fix most of the CSS update issues people are having:

    Make sure your app.yaml has the following:

     handlers:
       - url: /static
         static_dir: static
    
    • Run gcloud app deploy
    • Chill for 10 minutes.. and the shift-reload your website
    0 讨论(0)
  • 2020-12-09 03:57

    If you use 2020 GCP App Engine, just add default_expiration to your app.yaml file and set it to 1m.

    default_expiration: "1m"
    

    More info: https://cloud.google.com/appengine/docs/standard/python3/config/appref/#runtime_and_app_elements

    0 讨论(0)
  • 2020-12-09 04:05

    Following is what has worked for me.

    1. Serve your css file from the static domain. This is automatically created by GAE.

      //static.{your-app-id}.appspot.com/{css-file-path}

    2. Deploy your application. At this point your app will be broken.

    3. change the version of the css file

      //static.{your-app-id}.appspot.com/{css-file-path}?v={version-Name}

    4. deploy again.

    Every time you change the css file. you will have to repeat 2,3 and 4.

    0 讨论(0)
  • 2020-12-09 04:06

    Make sure to add wildcard at the end of the url and service setup on dispatch.yaml file.

    Example:

    dispatch:
      - url: "example.com/*"
        service: default
    
      - url: "sub.example.com/*"
        service: subexample
    
    0 讨论(0)
  • 2020-12-09 04:07

    Ok For newer people seeing this problem i tried the cache-bursting approach and seem to have fixed it here is an example of what i did for the css import on app.cfg file create a variable to hold your appid as set in app.yaml file and set it as one below

    <link href="{{ url_for('static', filename='file.css') }}?{{config.APP_ID}}" rel="stylesheet"> 
    

    Also for the app.yaml file add this config to be on the safe side

    handlers:

    • url: /static static_dir: static
    0 讨论(0)
  • 2020-12-09 04:07

    Try clearing cache on your browser. Had exact same issue and got it fixed by simply clearing cache.

    0 讨论(0)
提交回复
热议问题