0

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)

Pythonファイルのみに制限することなくgrep -rl --include \*.py 'Context('、何も表示しませんでした.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
4

1 に答える 1

0

Django 1.10 リリース ノートには、

「get_template() および select_template() によって返される Django テンプレート オブジェクトは、render() メソッドで Context を受け入れなくなりました。」

これが警告の原因となっている可能性があります。1.10 のリリース ノートはこちら: https://docs.djangoproject.com/en/2.0/releases/1.10/

また、1.9 が Django のサポートされているバージョンではないことをまだご存じない方のために

于 2018-02-25T01:43:24.710 に答える