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.
% typename) Exception Type: DataError at / Exception Value: Invalid input of type: 'CacheKey'. Convert to a byte, string or number first. redis-py 3.0 only accepts keys and values as bytes, strings or numbers.
There are errors like TransactionManagementError for all transaction-related problems with the database. 6. Testing Framework Exceptions The django.test package also comes with many exceptions. We have also raised one exception from this class in our Django Redirect Tutorial . It is the infinite loop that we created with redirects.
The exception wrappers provided by Django work in the same way as Python database API. 4. Http Exceptions We used this class in our first views. The HttpResponse is a sub-class of django.http class. The module provides some exceptions and special responses. This exception occurs when a user uploads a corrupt file or cancels an upload.
It searches the object on the basis of arguments passed in the get (). If the get () does not find any object, it raises this error. 1.3. EmptyResultSet This error is rare in Django. When we generate a query for objects and if the query doesn’t return any results, it raises this error. The error is rare because most of the queries return something.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With