0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

DRFのDjangoFilterBackend使ったらTemplateDoesNotExistと出たときの対処法

Posted at

DRFでAPIを書いてるので、テンプレートなんて使うことなんて絶対ないのに、
TemplateDoesNotExist
ってでてきて結構調べたのでメモです。

今まではなんともなかったのですが、タイトルにもあるとおりDjangoFilterBackendを入れた瞬間にエラーが出た始めたんですよね。

いろんなサイトに書かれてあるとおりにやってるはずなんだけどなぁ。と思ってたのですが最終的に、
https://django-filter.readthedocs.io/en/stable/guide/migration.html

を見ましたら、

Templates are now provided by django-filter. 
If you are receiving this error, you may need to add 'django_filters' to your INSTALLED_APPS setting.
Alternatively, you could provide your own templates.

とかかれてあるではないですか。

というわけで、settings.pyのINSTALLED_APPSに、
django_filters
を追加したら無事エラーも消えて希望通りの動作をしてくれました。

めでたしめでたし。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?