Django-filter: Error : TemplateDoesNotExist django_filters/rest_framework/crispy_form.html

Created on 21 Jun 2017  路  6Comments  路  Source: carltongibson/django-filter

Hi,

I am getting the following error:

TemplateDoesNotExist
Exception Value: django_filters/rest_framework/crispy_form.html
Exception Location: /home/dheeraj/.virtualenvs/ngcrp_env/lib/python3.5/site-packages/django/template/loader.py in get_template, line 25
Python Executable: /home/dheeraj/.virtualenvs/ngcrp_env//bin/python3.5

Following are the packages I have:
django-filter Version: 1.0.4
djangorestframework Version: 3.6.3
Django Version: 1.11.2
django-crispy-forms Version: 1.6.1

Following is traceback:

Traceback:

File "/home/dheeraj/.virtualenvs/ngcrp_env/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner

  1. response = get_response(request)

File "/home/dheeraj/.virtualenvs/ngcrp_env/lib/python3.5/site-packages/django/core/handlers/base.py" in _legacy_get_response

  1. response = self._get_response(request)

File "/home/dheeraj/.virtualenvs/ngcrp_env/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response

  1. response = self.process_exception_by_middleware(e, request)

File "/home/dheeraj/.virtualenvs/ngcrp_env/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response

  1. response = response.render()

File "/home/dheeraj/.virtualenvs/ngcrp_env/lib/python3.5/site-packages/django/template/response.py" in render

  1. self.content = self.rendered_content

File "/home/dheeraj/.virtualenvs/ngcrp_env/lib/python3.5/site-packages/rest_framework/response.py" in rendered_content

  1. ret = renderer.render(self.data, accepted_media_type, context)

File "/home/dheeraj/.virtualenvs/ngcrp_env/lib/python3.5/site-packages/rest_framework/renderers.py" in render

  1. context = self.get_context(data, accepted_media_type, renderer_context)

File "/home/dheeraj/.virtualenvs/ngcrp_env/lib/python3.5/site-packages/rest_framework/renderers.py" in get_context

  1. 'filter_form': self.get_filter_form(data, view, request),

File "/home/dheeraj/.virtualenvs/ngcrp_env/lib/python3.5/site-packages/rest_framework/renderers.py" in get_filter_form

  1. html = backend().to_html(request, queryset, view)

File "/home/dheeraj/.virtualenvs/ngcrp_env/lib/python3.5/site-packages/django_filters/rest_framework/backends.py" in to_html

  1. template = loader.get_template(self.template)

File "/home/dheeraj/.virtualenvs/ngcrp_env/lib/python3.5/site-packages/django/template/loader.py" in get_template

  1. raise TemplateDoesNotExist(template_name, chain=chain)

Could you please help here...
Thanks.
Dheeraj

Most helpful comment

@devrishu I think a better solution is probably to make sure django_filters is added to INSTALLED_APPS. (That way the templates will be found.)

All 6 comments

error was gone by adding django_filters to installed apps as suggested by carltongibson.

@devrishu I think a better solution is probably to make sure django_filters is added to INSTALLED_APPS. (That way the templates will be found.)

@carltongibson thanks for your help. It worked !!!

Make sure you added "django_filters" to INSTALLED_APPS

Make sure you added "django_filters" to INSTALLED_APPS (take care about the 's')

and the underscore "django_filters"

Was this page helpful?
0 / 5 - 0 ratings