Django: collect modified static files

I use amazon s3 to store all my static files (via django-storageages) and it costs a lot more money to do PUT than GET. When I run manage.py collectstatic , Django does a PUT for every static file that I have. Is there a way to check this first to see if the file has changed at all, and if it was not worried about PUT?

+6
source share
1 answer

It seems that all you need to do is install python-dateutil:

 pip install python-dateutil==1.2 

Without this, django stores will not check dates due to this code:

 def modified_time(self, name): try: from dateutil import parser, tz except ImportError: raise NotImplementedError() 

modified_time throws an error, but django just continues to work, because it does not allow to implement the modified_time method of the storage subclass. I understand why they do this because this functionality is not strictly necessary. However, it would be nice to have some kind of warning about why ALL is loading.

Please note that I am using python-dateutil version 1.2. If you use the latest version of dateutil, you will get an error message with django repositories (this is django repositories version 1.1.4).

+12
source

Source: https://habr.com/ru/post/909402/


All Articles