我在日志中得到了这个,在将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'x80x04x95x16x01x00x00x00x00x00x00x8cx15django.db.models.basex94x8cx0emodel_unpicklex94x93x94x8cx0eadministrationx94x8cx15SiteWideConfigurationx94x86x94]x94hx00x8cx14si
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'x80x04x95x16x01x00x00x00x00x00x00x8cx15django.db.models.basex94x8cx0emodel_unpicklex94x93x94x8cx0eadministrationx94x8cx15SiteWideConfigurationx94x86x94]x94hx00x8cx14si
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
django 1.10发行说明它具有
" django模板对象get_template((返回的对象和select_template((不再接受其render((方法中的上下文。"
这可能引起警告。1.10的发行说明在这里:https://docs.djangoproject.com/en/2.0/releases/1.10/
,如果您还不知道1.9不再是Django的支持版本