错误日志(error log):
代码语言:javascript复制django.request: 2020-05-27 15:43:54,265 E:py_virtualenvjoyoolibsite-packagesdjangoutilslog.py [line:228] ERROR Internal Server Error: /api/articles/
Traceback (most recent call last):
File "E:py_virtualenvjoyoolibsite-packagesdjangocorehandlersexception.py", line 34, in inner
response = get_response(request)
File "E:py_virtualenvjoyoolibsite-packagesdjangocorehandlersbase.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "E:py_virtualenvjoyoolibsite-packagesdjangocorehandlersbase.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "E:py_virtualenvjoyoolibsite-packagesdjangoviewsdecoratorscsrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "E:py_virtualenvjoyoolibsite-packagesrest_frameworkviewsets.py", line 114, in view
return self.dispatch(request, *args, **kwargs)
File "E:py_virtualenvjoyoolibsite-packagesrest_frameworkviews.py", line 505, in dispatch
response = self.handle_exception(exc)
File "E:py_virtualenvjoyoolibsite-packagesrest_frameworkviews.py", line 465, in handle_exception
self.raise_uncaught_exception(exc)
File "E:py_virtualenvjoyoolibsite-packagesrest_frameworkviews.py", line 476, in raise_uncaught_exception
raise exc
File "E:py_virtualenvjoyoolibsite-packagesrest_frameworkviews.py", line 502, in dispatch
response = handler(request, *args, **kwargs)
File "E:py_virtualenvjoyoolibsite-packagesrest_framework_extensionscachedecorators.py", line 59, in inner
kwargs=kwargs,
File "E:py_virtualenvjoyoolibsite-packagesrest_framework_extensionscachedecorators.py", line 85, in process_cache_response
response.render()
File "E:py_virtualenvjoyoolibsite-packagesdjangotemplateresponse.py", line 106, in render
self.content = self.rendered_content
File "E:py_virtualenvjoyoolibsite-packagesrest_frameworkresponse.py", line 70, in rendered_content
ret = renderer.render(self.data, accepted_media_type, context)
File "E:py_virtualenvjoyoolibsite-packagesrest_frameworkrenderers.py", line 724, in render
context = self.get_context(data, accepted_media_type, renderer_context)
File "E:py_virtualenvjoyoolibsite-packagesrest_frameworkrenderers.py", line 702, in get_context
'filter_form': self.get_filter_form(data, view, request),
File "E:py_virtualenvjoyoolibsite-packagesrest_frameworkrenderers.py", line 634, in get_filter_form
html = backend().to_html(request, queryset, view)
File "E:py_virtualenvjoyoolibsite-packagesdjango_filtersrest_frameworkbackends.py", line 63, in to_html
template = loader.get_template(self.template)
File "E:py_virtualenvjoyoolibsite-packagesdjangotemplateloader.py", line 19, in get_template
raise TemplateDoesNotExist(template_name, chain=chain)
django.template.exceptions.TemplateDoesNotExist: django_filters/rest_framework/crispy_form.html
解决办法(solution):
安装应用 django_filters
到 settings.py 的 INSTALLED_APPS.
You may need to add 'django_filters'
to INSTALLED_APPS of settings.py
.