我正在尝试在django项目中实现django-session-security。遵循instructions之后,出现错误消息:
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
2018-10-22 11:30:21,297 django.request ERROR Internal Server Error: /accounts/login/
Traceback (most recent call last):
File "/home/joel/.local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/home/joel/.local/lib/python3.6/site-packages/django/core/handlers/base.py", line 156, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/joel/.local/lib/python3.6/site-packages/django/core/handlers/base.py", line 154, in _get_response
response = response.render()
File "/home/joel/.local/lib/python3.6/site-packages/django/template/response.py", line 106, in render
self.content = self.rendered_content
File "/home/joel/.local/lib/python3.6/site-packages/django/template/response.py", line 83, in rendered_content
content = template.render(context, self._request)
File "/home/joel/.local/lib/python3.6/site-packages/django/template/backends/django.py", line 61, in render
return self.template.render(context)
File "/home/joel/.local/lib/python3.6/site-packages/django/template/base.py", line 169, in render
with context.bind_template(self):
File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__
return next(self.gen)
File "/home/joel/.local/lib/python3.6/site-packages/django/template/context.py", line 242, in bind_template
processors = (template.engine.template_context_processors +
File "/home/joel/.local/lib/python3.6/site-packages/django/utils/functional.py", line 37, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/joel/.local/lib/python3.6/site-packages/django/template/engine.py", line 85, in template_context_processors
return tuple(import_string(path) for path in context_processors)
File "/home/joel/.local/lib/python3.6/site-packages/django/template/engine.py", line 85, in <genexpr>
return tuple(import_string(path) for path in context_processors)
File "/home/joel/.local/lib/python3.6/site-packages/django/utils/module_loading.py", line 17, in import_string
module = import_module(module_path)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django.core.context_processors'
settings.py:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.request',
],
},
},
]
我已阅读以下相关问题,但这些问题似乎不适用于我的情况: