CSSAbsoluteUrl rewrite doesn't work on restart process on Heroku #304

sprynmr opened this Issue Aug 22, 2012 · 5 comments


None yet

3 participants

sprynmr commented Aug 22, 2012

Not 100% sure if this is an issue or not.

My Heroku procfile looks like this:

``web: python manage.py collectstatic --noinput; python manage.py compress; newrelic-admin run-program python manage.py run_gunicorn -b "$PORT" -w 9 -k gevent --max-requests 250`

This works perfectly when I do a git push. It rewrites all the relative URLS's to my S3 absolute URLS. However if the dyno processes restart, it successfully copies the assets and creates a new cache file for the css, but it doesn't rewrite the relative URLs, so all of the sudden my assets are looking in the wrong place (relative out of the CACHE folder).

sprynmr commented Aug 22, 2012

Doing more investigation. On initial push, the filename does start with self.root which is /app/static. However when the process resets, it instead starts with one of my static folders /app/assets. Since they don't match, it just returns the content.

sprynmr commented Aug 22, 2012

The problem exists here in base.py:

            # call path first so remote storages don't make it to exists,
            # which would cause network I/O
            filename = self.storage.path(basename)
            print "first filename %s" % filename
            if not self.storage.exists(basename):
                filename = None
        except NotImplementedError:
            # remote storages don't implement path, access the file locally
            if compressor_file_storage.exists(basename):
                filename = compressor_file_storage.path(basename)
                print "second filename %s" % filename

During the push the try fails and the exception happens. During the subsequent restart, the try succeeds and returns a different filename.

sprynmr commented Aug 23, 2012

Are you able to maybe provide insight as to what is going on in this bit of code, and then I can try to address the issue with a pull request?

sprynmr commented Sep 15, 2012

Anyone? People must be using this on heroku.

jezdez commented Oct 4, 2012

Sorry, I'm not sure what's going on here.

@diox diox added the deployment label Sep 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment