Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django-Redis DataError Invalid type 'CacheKey' #6887

Open
arky opened this issue Jan 27, 2019 · 0 comments
Open

Django-Redis DataError Invalid type 'CacheKey' #6887

arky opened this issue Jan 27, 2019 · 0 comments
Labels

Comments

@arky
Copy link
Contributor

arky commented Jan 27, 2019

Steps to reproduce:

Pootle Linux development environment setup fails at 'pootle migrate' step with "redis.exceptions.DataError: Invalid input of type: 'CacheKey'. Convert to a byte, string or number first" error.

Results (Expected/Actual):

Traceback (most recent call last):
  File "/home/arky/.venvs/pootle_test/bin/pootle", line 11, in <module>
    load_entry_point('Pootle', 'console_scripts', 'pootle')()
  File "/home/arky/Code/Django/pootle/pootle/runner.py", line 365, in main
    run_app(project='pootle', django_settings_module='pootle.settings')
  File "/home/arky/Code/Django/pootle/pootle/runner.py", line 320, in run_app
    caches = settings.CACHES.keys()
  File "/home/arky/.venvs/pootle_test/local/lib/python2.7/site-packages/django/conf/__init__.py", line 56, in __getattr__
    self._setup(name)
  File "/home/arky/.venvs/pootle_test/local/lib/python2.7/site-packages/django/conf/__init__.py", line 41, in _setup
    self._wrapped = Settings(settings_module)
  File "/home/arky/.venvs/pootle_test/local/lib/python2.7/site-packages/django/conf/__init__.py", line 129, in __init__
    raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
(pootle_test) arky@Think:~/Code/Django/pootle$ pootle init 
File already exists at '/home/arky/.venvs/pootle_test/pootle.conf', overwrite? [Ny] n
2019-01-27 16:07:56,478 ERROR File already exists, not overwriting.
(pootle_test) arky@Think:~/Code/Django/pootle$ nano ~/.venvs/pootle_test/pootle.conf 
(pootle_test) arky@Think:~/Code/Django/pootle$ pootle migrate
Traceback (most recent call last):
  File "/home/arky/.venvs/pootle_test/bin/pootle", line 11, in <module>
    load_entry_point('Pootle', 'console_scripts', 'pootle')()
  File "/home/arky/Code/Django/pootle/pootle/runner.py", line 365, in main
    run_app(project='pootle', django_settings_module='pootle.settings')
  File "/home/arky/Code/Django/pootle/pootle/runner.py", line 346, in run_app
    management.execute_from_command_line(command)
  File "/home/arky/.venvs/pootle_test/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/home/arky/.venvs/pootle_test/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/arky/.venvs/pootle_test/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/arky/.venvs/pootle_test/local/lib/python2.7/site-packages/django/core/management/base.py", line 327, in execute
    self.check()
  File "/home/arky/.venvs/pootle_test/local/lib/python2.7/site-packages/django/core/management/base.py", line 359, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/arky/.venvs/pootle_test/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 62, in _run_checks
    issues.extend(super(Command, self)._run_checks(**kwargs))
  File "/home/arky/.venvs/pootle_test/local/lib/python2.7/site-packages/django/core/management/base.py", line 346, in _run_checks
    return checks.run_checks(**kwargs)
  File "/home/arky/.venvs/pootle_test/local/lib/python2.7/site-packages/django/core/checks/registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/arky/Code/Django/pootle/pootle/checks.py", line 478, in check_revision
    revision = Revision.get()
  File "/home/arky/Code/Django/pootle/pootle/core/models/revision.py", line 45, in get
    return cache.get(cls.CACHE_KEY)
  File "/home/arky/.venvs/pootle_test/local/lib/python2.7/site-packages/django_redis/cache.py", line 32, in _decorator
    return method(self, *args, **kwargs)
  File "/home/arky/.venvs/pootle_test/local/lib/python2.7/site-packages/django_redis/cache.py", line 81, in get
    client=client)
  File "/home/arky/.venvs/pootle_test/local/lib/python2.7/site-packages/django_redis/client/default.py", line 202, in get
    value = client.get(key)
  File "/home/arky/.venvs/pootle_test/local/lib/python2.7/site-packages/redis/client.py", line 1207, in get
    return self.execute_command('GET', name)
  File "/home/arky/.venvs/pootle_test/local/lib/python2.7/site-packages/redis/client.py", line 754, in execute_command
    connection.send_command(*args)
  File "/home/arky/.venvs/pootle_test/local/lib/python2.7/site-packages/redis/connection.py", line 619, in send_command
    self.send_packed_command(self.pack_command(*args))
  File "/home/arky/.venvs/pootle_test/local/lib/python2.7/site-packages/redis/connection.py", line 659, in pack_command
    for arg in imap(self.encoder.encode, args):
  File "/home/arky/.venvs/pootle_test/local/lib/python2.7/site-packages/redis/connection.py", line 124, in encode
    "byte, string or number first." % typename)
redis.exceptions.DataError: Invalid input of type: 'CacheKey'. Convert to a byte, string or number first.

Environment (i.e. 'pootle --version', DB, OS, Browser):

$ pootle --version
Pootle 2.9.0rc1 [187ecc9] (Django 1.11.18, Translate Toolkit 2.3.0)

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.10
Release: 18.10
Codename: cosmic

$ pip show redis
Name: redis
Version: 3.0.1
Summary: Python client for Redis key-value store
Home-page: https://github.com/andymccurdy/redis-py
Author: Andy McCurdy
Author-email: [email protected]
License: MIT
Location: /home/arky/.venvs/pootle_test/lib/python2.7/site-packages
Requires:
Required-by: rq, django-redis
(pootle_test) arky@Think:~/Code/Django/pootle/requirements$ pip install redis==2.10.6

Workaround

You could either downgrade your redis to (pip install redis==2.10.6) or upgrade django-redis (pip install django-redis==4.10.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant