Reputation: 2550
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?
Upvotes: 2
Views: 376
Reputation: 79
I have
TIME_ZONE = 'UTC'
in my settings.py
but In my case I had to remove whitenoise to work in both local and production.
Remove
'whitenoise.middleware.WhiteNoiseMiddleware',
from MIDDLEWARE,
and
'whitenoise.runserver_nostatic',
from INSTALLED_APPS
Upvotes: 0
Reputation: 614
I'm using Django 1.10.6 and I used this tutorial to get static files working on S3.
For me TIME_ZONE = None
didn't work. But this works for me:
TIME_ZONE = 'UTC'
So I made a settings/collectstatic.py file to run local and sync s3 files to production.
Upvotes: 0
Reputation: 169
It's really weird but changing the TIME_ZONE to None worked for me as well.
Upvotes: 0
Reputation: 2550
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
Upvotes: 4