22👍
This config for pylint
is working for me:
"python.linting.pylintEnabled": true,
"python.linting.pylintArgs": [
"--disable=C0111", // missing docstring
"--load-plugins=pylint_django,pylint_celery",
],
4👍
I just got the same issue. Like @J0hnG4lt said, I had a problem with the python path. I didn’t point to the path of the environment, which I have installed pylint_django. This config is work for me. Thanks @Manu.
"python.pythonPath": "/Users/mc976/Documents/Programming/Python/Practice/music_service/venv/bin/python3",
"python.linting.pylintEnabled": true,
"python.linting.pylintArgs": [
"--disable=C0111",
"--load-plugins",
"pylint_django"
]
Besides, I think you should check your environment to make sure that you have correctly installed pylint_django
by using pip list
.
- [Django]-Unique BooleanField value in Django?
- [Django]-Installing PIL with JPEG support on Mac OS X
- [Django]-What is a django.utils.functional.__proxy__ object and what it helps with?
2👍
My issue was more prosaic (but perhaps it will help other forehead slappers like myself). Run the PIP install in the correct virtualenv directory!
pip install pylint-django --upgrade
Also note that plugin errors cause Pylint to completely fail to load silently. Start with blank pylintArgs
and slowly add them back one at a time to see where things go awry.
- [Django]-Django Rest frameworks: request.Post vs request.data?
- [Django]-What's the difference between STATIC_URL and STATIC_ROOT in Django?
- [Django]-Template filter to trim any leading or trailing whitespace
- [Django]-What is the max size of 'max_length' in Django?
- [Django]-Model.objects.get() or None
- [Django]-Django-Registration & Django-Profile, using your own custom form
1👍
found a working answer for myself here: https://donjayamanne.github.io/pythonVSCodeDocs/docs/linting/
my settings.json file now reads:
{
"python.pythonPath": "C:\\ProgramData\\Anaconda3\\envs\\djangoSite2\\python.exe",
"python.linting.pylintEnabled": true,
"python.linting.pylintArgs": ["--disable=C0111","--load-plugins", "pylint_django"],
}
this then adds linting, but doesn’t throw an error on fields that it can’t find (like the Entity.objects.all() one), but has the disadvantage that if you then try and reference something that really doesn’t exist it doesn’t throw an error.
- [Django]-Django 1.8 – what's the difference between migrate and makemigrations?
- [Django]-Session database table cleanup
- [Django]-Is there a filter for divide for Django Template?
1👍
It now works on my Mac. This is my workspace’s settings.json
:
{
"python.linting.pylintEnabled": true,
"python.linting.pycodestyleEnabled": false,
"files.autoSave": "afterDelay",
"editor.fontSize": 14,
"editor.wordWrapColumn": 90,
"editor.autoClosingQuotes": "beforeWhitespace",
"python.pythonPath": "/Users/myname/anaconda3/envs/myproject/bin/python",
"python.linting.pylintArgs": [
"--disable=C0111", // missing docstring
"--load-plugins=pylint_django",
],
}
I had to be careful to have installed pylint-django into the correct python environment. For me, this meant running this command in the terminal:
$ /Users/myname/anaconda3/envs/myproject/bin/python -m install pip pylint pylint-django
- [Django]-How to get Django and ReactJS to work together?
- [Django]-Pip install PIL fails
- [Django]-Django can we select related a field on a prefetch related model?
0👍
I ran into an error related to pylint not being able to parse JSON correctly. All I had to do was add an ‘s’ to my config to make it plugins (plural) instead of plugin. Then everything started working.
"python.linting.pylintArgs": [
"--load-plugins=pylint_django",
],
- [Django]-How to set and get session in Django?
- [Django]-How to output Django queryset as JSON?
- [Django]-TextField missing in django.forms
- [Django]-How to find pg_config path
- [Django]-How can I register a single view (not a viewset) on my router?
- [Django]-Curious about get_form_kwargs in FormView
0👍
My setup needed a details missing from other answers, namely the correct settings module:
// .vscode/settings.json
{
"python.linting.pylintArgs": [
"--load-plugins",
"pylint_django",
"--django-settings-module=myapp.settings"
]
}
The linter hints at the solution in places, instructing you to execute:
pylint --load-plugins=pylint_django --help-msg=django-not-configured
…which produces:
:django-not-configured (E5110): Django was not configured. For more information run
pylint --load-plugins=pylint_django --help-msg=django-not-configured
Finding foreign-key relationships from strings in pylint-django requires
configuring Django. This can be done via the DJANGO_SETTINGS_MODULE
environment variable or the pylint option django-settings-module, eg:
pylint --load-plugins=pylint_django --django-settings-module=myproject.settings
.This can also be set as an option in a .pylintrc configuration file. Some
basic default settings were used, however this will lead to less accurate
linting. Consider passing in an explicit Django configuration file to match
your project to improve accuracy. This message belongs to the django foreign
keys referenced by strings checker.
- [Django]-How to see details of Django errors with Gunicorn?
- [Django]-Use only some parts of Django?
- [Django]-Django Admin filter on Foreign Key property