We suddenly started getting this issue when compressing django static files on production servers. Ubuntu 16.04, Python 3.x, Django 1.11. I am using an ansible-playbook to deploy.
The error is as follows:
CommandError: An error occurred during rendering /chalktalk/app/chalktalk-react-40/chalktalk-react-40/chalktalk/apps/exams/templates/exams/section-edit.html: Invalid input of type: 'CacheKey'. Convert to a byte, string or number first.
It doesn't seem to be an issue in one of the static files but a general issue. Every time we run it, we get a different file.
I was looking for any clues on google and nothing shows up with the same error.
This is due to an change in the redis
library between v2 and v3. Try pinning your redis
version to 2.10.6
from August 17, 2017, the last redis
version before the change.
pip install redis==2.10.6
# and/or
echo redis==2.10.6 >> requirements.txt
I am not sure what package you are using which may be requiring redis as a dependency, or if you are using it yourself. In either case its the same process.
In my case this shows up through the django-redis
package, which requires the underlying redis
package. Django-redis
doesn't restrict the maximum version, so it happily upgrades past a major version bump, which you can't really do since thats where you expect the API to change!
The exact code (in my case), in master at django-redis:
install_requires = [
"redis>=2.10.0",
]
But it should really be this
install_requires = [
"redis>=2.10.0, <3",
]
Edit: I found the bug report in django-redis (#342) about this just now, but this SO question came up first in google when I was looking into it.