pylint (pylint_django) does not work when --django-settings-module flag is specified

Viewed 671

I am using newest version of pylint_django released few days ago:

Package                       Version
----------------------------- ----------
pylint                        2.7.4
pylint-django                 2.4.3
pylint-plugin-utils           0.6

When I enabled pylint in VSC with pylint_diango extension I get this error

Django was not configured. For more information runpylint --load-plugins=pylint_django --help-msg=django-not-configured

I followed these instructions to fix that and added following lines to my settings.json:

{
  ...
  "python.linting.pylintArgs": [
    "--load-plugins=pylint_django"
    "--django-settings-module=wapp.settings"
  ]
}

However after specifying --django-settings-module=wapp.settings flag pylint stops working. My Django project structure (root directory which is opened in VSC) looks like this:

.
├── ...
├── manage.py
├── media
│   └── profile_pictures
├── requirements.txt
├── ...
├── venv
└── wapp
    ├── asgi.py
    ├── __init__.py
    ├── __pycache__
    ├── secrets.py
    ├── settings.py
    ├── urls.py
    └── wsgi.py

I've also tried to specify DJANGO_SETTINGS_MODULE environment variable but it seemed to have no effect. I've also tried to run pylint directly from command line to see if the flags are working. When I run pylint path/to/some/python_file.py linter produced correct output, but when I tried pylint --load-plugins=pylint_django path/to/some/python_file.py I got an error ModuleNotFoundError: No module named 'wapp'.

Does anyone stumbled upon similar problem?

0 Answers
Related