Не могу найти причину RemovedInDjango110Warning

Я получил это в своем журнале, после обновления Python с 2.7 до 3.5, нет полной трассировки стека, я не уверен, как это исправить.

/root/.virtualenvs/python3/lib/python3.5/site-packages/django/template/loader.py:97: RemovedInDjango110Warning: render() must be called with a dict, not a RequestContext.
  return template.render(context, request)

2018-02-24 21:53:07,452 - WARNING - django - /root/.virtualenvs/python3/lib/python3.5/site-packages/django/template/loader.py:97: RemovedInDjango110Warning: render() must be called with a dict, not a RequestContext.
  return template.render(context, request)

я сделал grep -rl --include \*.py 'Context(', ничего не показывает, не ограничиваясь только файлами Python, он даст мне кучу файлов JavaScript (React).

Джанго == 1.9.3


Обновление до Django==1.10 даст мне больше ошибок, которые я не знаю, как исправить.

Internal Server Error: /exercises/
Traceback (most recent call last):
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django_redis/client/default.py", line 313, in decode
    value = int(value)
ValueError: invalid literal for int() with base 10: b'\x80\x04\x95\x16\x01\x00\x00\x00\x00\x00\x00\x8c\x15django.db.models.base\x94\x8c\x0emodel_unpickle\x94\x93\x94\x8c\x0eadministration\x94\x8c\x15SiteWideConfiguration\x94\x86\x94]\x94h\x00\x8c\x14si

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django/core/handlers/exception.py", line 39, in inner
    response = get_response(request)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
    response = self._get_response(request)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django/core/handlers/base.py", line 217, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/channels/handler.py", line 194, in process_exception_by_middleware
    return super(AsgiHandler, self).process_exception_by_middleware(exception, request)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django/core/handlers/base.py", line 215, in _get_response
    response = response.render()
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django/template/response.py", line 109, in render
    self.content = self.rendered_content
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django/template/response.py", line 86, in rendered_content
    content = template.render(context, self._request)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django/template/backends/django.py", line 66, in render
    return self.template.render(context)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django/template/base.py", line 206, in render
    with context.bind_template(self):
  File "/usr/lib/python3.5/contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/debug_toolbar/panels/templates/panel.py", line 50, in _request_context_bind_template
    context = processor(self.request)
  File "/home/miranda/workspace/CodeBench/common/context_processors.py", line 8, in settings_processor
    sw_cfg = SiteWideConfiguration.get_solo()
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/solo/models.py", line 47, in get_solo
    obj = cache.get(cache_key)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django_redis/cache.py", line 33, in _decorator
    return method(self, *args, **kwargs)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django_redis/cache.py", line 82, in get
    client=client)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django_redis/client/default.py", line 208, in get
    return self.decode(value)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django_redis/client/default.py", line 320, in decode
    value = self._serializer.loads(value)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django_redis/serializers/pickle.py", line 36, in loads
    return pickle.loads(force_bytes(value))
AttributeError: Can't get attribute 'simple_class_factory' on <module 'django.db.models.base' from '/root/.virtualenvs/python3/lib/python3.5/site-packages/django/db/models/base.py'>
2018-02-25 13:04:04,715 - ERROR - exception - Internal Server Error: /exercises/
Traceback (most recent call last):
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django_redis/client/default.py", line 313, in decode
    value = int(value)
ValueError: invalid literal for int() with base 10: b'\x80\x04\x95\x16\x01\x00\x00\x00\x00\x00\x00\x8c\x15django.db.models.base\x94\x8c\x0emodel_unpickle\x94\x93\x94\x8c\x0eadministration\x94\x8c\x15SiteWideConfiguration\x94\x86\x94]\x94h\x00\x8c\x14si

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django/core/handlers/exception.py", line 39, in inner
    response = get_response(request)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
    response = self._get_response(request)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django/core/handlers/base.py", line 217, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/channels/handler.py", line 194, in process_exception_by_middleware
    return super(AsgiHandler, self).process_exception_by_middleware(exception, request)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django/core/handlers/base.py", line 215, in _get_response
    response = response.render()
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django/template/response.py", line 109, in render
    self.content = self.rendered_content
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django/template/response.py", line 86, in rendered_content
    content = template.render(context, self._request)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django/template/backends/django.py", line 66, in render
    return self.template.render(context)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django/template/base.py", line 206, in render
    with context.bind_template(self):
  File "/usr/lib/python3.5/contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/debug_toolbar/panels/templates/panel.py", line 50, in _request_context_bind_template
    context = processor(self.request)
  File "/home/miranda/workspace/CodeBench/common/context_processors.py", line 8, in settings_processor
    sw_cfg = SiteWideConfiguration.get_solo()
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/solo/models.py", line 47, in get_solo
    obj = cache.get(cache_key)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django_redis/cache.py", line 33, in _decorator
    return method(self, *args, **kwargs)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django_redis/cache.py", line 82, in get
    client=client)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django_redis/client/default.py", line 208, in get
    return self.decode(value)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django_redis/client/default.py", line 320, in decode
    value = self._serializer.loads(value)
  File "/root/.virtualenvs/python3/lib/python3.5/site-packages/django_redis/serializers/pickle.py", line 36, in loads
    return pickle.loads(force_bytes(value))
AttributeError: Can't get attribute 'simple_class_factory' on <module 'django.db.models.base' from '/root/.virtualenvs/python3/lib/python3.5/site-packages/django/db/models/base.py'>

У меня установлено следующее:

asgi-redis==0.8.3
django-redis==4.8.0
django-solo==1.1.2

1 ответ

В заметках о выпуске Django 1.10

"Объекты шаблонов Django, возвращаемые get_template() и select_template(), больше не принимают контекст в своем методе render()".

Это может быть причиной предупреждения. Примечания к выпуску для 1.10 находятся здесь: https://docs.djangoproject.com/en/2.0/releases/1.10/

Также, если вы еще не знаете, 1.9 больше не является поддерживаемой версией Django

Другие вопросы по тегам