If you're using Mezzanine and s3, and you get an error like
File "/storages/backends/s3boto.py" in modified_time 455. return parse_ts_extended(entry.last_modified) File "/storages/backends/s3boto.py" in parse_ts_extended 39. rv = parse_ts(ts) File "/boto/utils.py" in parse_ts 390. ts = ts.strip() Exception Type: AttributeError at /admin/filebrowser/browse/ Exception Value: 'NoneType' object has no attribute 'strip'
when attempting to upload a file, then fear not. This is a seemingly common error, and it comes from the
In a nutshell
last_modified attribute fails to get set for a new file uploaded, so
entry.last_modified in the s3boto code traceback above is
None. Stripping this
None object raises the exception. If you restart, you may force s3 to provide the timestamp on the next go around, and you will likely see the previously uploaded file in your media lib.
How to fix
You should be using
django-storages-redux now instead of
django-storages. It is the fork currently being maintained, and offers a solution to this problem and others.
Ensure that django storages is completely uninstalled from venv and system:
pip uninstall django-storages
then install redux
pip install django-storages-redux
There is no need to do anything else. The redux package can be added to
INSTALLED_APPS as storages just like the regular package, and imported as storages in your scripts.