1
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.

Class '~~~' has no 'objects' member pylint(no-member)との闘い

Last updated at Posted at 2021-06-27

大学の課題のシステム開発を行なっていたところ「Class '~~~' has no 'objects' memberpylint(no-member)」というエラーに直面してしまいました.
早速解決法をググってみて以下の通りに手を動かしてみます.
まずターミナルで

pip install pylint-django

を行い,pylintをインストールします.
その次にVScodeの設定ファイルを開き,(Win: Ctrl+, / Mac: Command+,)、以下の設定値を追加すると良いと書かれていたので素直に追加しました.

setting.json
"python.linting.pylintArgs": [
    "--load-plugins=pylint_django",
]

これで解決、と思いきやDjangoプロジェクト内で大量のエラーが発生してしまいました.
その後解決法がなかなか見つからず、ググり続けていった結果、ある一つの解決法が目にとまりました.
それが,setting.jsonに書いた上記の内容の代わりに下記を追加するという方法です.
こちらでエラーがうまく解消できました。

setting.json
 "python.linting.pylintArgs": [
        "...<other_settings>...",
        "--load-plugins",
        "pylint_django",
        "--django-settings-module",
        "<your_app>.settings",
 ]
1
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
1
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?