2
3

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 3 years have passed since last update.

Djangoバージョン依存エラーの解決

Posted at

Django2.2→3.0にアップデートした際に、以下のエラーが発生

エラー①

エラー文①
ModuleNotFoundError: No module named 'django.contrib.staticfiles.templatetags'

・原因と解決策

from django.contrib.staticfiles.templatetags.staticfiles import staticは、django3.0で
from django.templatetags.static import staticに変更されたため、こちらに書き換えれば解決

エラー②

エラー文②
ImportError: cannot import name 'render_to_response'

・原因と解決策

from django.shortcuts import render_to_responseは、django3.0で
from django.shortcuts import renderに変更されたため、こちらに書き換えれば解決

2
3
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
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?