-
Notifications
You must be signed in to change notification settings - Fork 118
"Django was not configured" since latest update #306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The error message says "Django was not configured. For more information run pylint --load-plugins=pylint_django --help-msg=django-not-configured" Did you run |
I did but I get the text below. I'm a bit lost since this is the first time it happens and only since the last update...
I always ran it with no problems with my settings as described above from settings.json (vscode) |
By the way I can confirm I don't get the error if I install v.2.3.0. It just happens with the latest release |
The error message, the error message explanation and the documentation all tell you exactly what to do: https://github.com/PyCQA/pylint-django#usage |
Okay, I'm not managing. Don't worry, I'll stay with 2.3.0 |
I'm not quite grokking what has changed since the update, I updated my commands as per the docs, and now pylint-django is complaining about LOGGING_CONFIG? Is pylint now trying to run Django @carlio ? Because that's a much more significant change... I'm confused why it needs this.
|
Ah, it now needs my runtime deps. I guess it's trying to introspect more of the modules? |
It is not. It's doing |
I worked around this using an init-hook # pyproject.toml
[tool.pylint.MASTER]
# see https://github.com/PyCQA/pylint-django/issues/306#issuecomment-859515591
init-hook = "import runpy; runpy.run_path('./top_level_package/django_project/pylint_init_hook.py');'" # ./top_level_package/django_project/pylint_init_hook.py
from __future__ import annotations
import os
def _configure_pylint_django():
os.environ["DJANGO_SETTINGS_MODULE"] = "top_level_package.django_project.settings"
os.environ["DJANGO_CONFIGURATION"] = "Dev"
from configurations import importer # type: ignore[import]
importer.install()
if __name__ == "<run_path>":
_configure_pylint_django() |
Uh oh!
There was an error while loading. Please reload this page.
Since the last update I get the error:
Django was not configured. For more information runpylint --load-plugins=pylint_django --help-msg=django-not-configured
First time I see it, no other settings changed.
I use pipenv, and I'm on VSCode.
My pip freeze:
And my settings.json for pylint are:
Am I doing anything wrong here?
The text was updated successfully, but these errors were encountered: