我在日志中得到了这个,在将 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)。
Django==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