Search code examples
djangoamazon-s3

Editing files on Amazon S3 with collectstatic


I'm using Amazon S3 to serve my static files. Everything has been set up and when I initially created my CSS files and ran

python manage.py collectstatic

it informed me that everything went fine and my CSS file was copied. Sure enough when viewing the bucket in the browser, it was there. When I edit the file locally and re-run collect static it tells me no static files were copied but 73 were modified. When I check in the browser the changes aren't present in the CSS file; it just looks like the initial version I created.

I figured it'd be a permission error and when I checked I noticed everyone didn't have edit permissions (I know I shouldn't let everyone edit it, but I just want to get it working for the moment). I changed it so everyone could edit, view and download and tried to recollect static but to no avail. The file hadn't been edited.

Am I missing something?


Solution

  • The reason for this was pretty bizarre. Effectively the problem was timezones. It thought the files on S3 were younger than the files locally due to time difference discrepancies. I fixed this by editing the TIME_ZONE variable in settings.py with the following:

    TIME_ZONE = None