Reputation: 159
I installed some extensions in Visual Studio Code for develop in Django. My only problem is when I'm trying to do this;
from my_app_name import views
I received a warning from Visual Studio Code.
If a typed like this;
from . import views
I don't received any warning! But a would prefer the other form above.
Note: My project run well because is only a warning but I would prefer that warning disappear.
Fast solution for me:
open project folder Just open one project directory.
Upvotes: 1
Views: 6905
Reputation: 781
If you get the Error that django-not-configured (E5110): *Django was not configured
, you also need to run pylint --django-settings-module=<YOUR DJANGO PROJECT NAME>.settings
or add it to your settings.json
file of your Django project. I prefer the latter and therefore my settings.json
has these entries:
"python.linting.pylintArgs": [
"--load-plugins","pylint_django",
"--django-settings-module","<YOUR DJANGO PROJECT NAME>.settings",
],
NOTE: The <YOUR DJANGO PROJECT NAME>
should be replaced by the name of your Django project.
Upvotes: 0
Reputation: 1909
There might be several issues here (If the Warning appears only in the problems panel, I believe you should start with the last one)
To rule them out try this:
create a new project and add a module
django-admin startproject your_project
python manage.py startapp your_app
Chose the interpreter+linter(pylint) from your conda environment vs-code-interpreter
Add this to your workspace settings
"python.linting.pylintArgs": ["--load-plugins", "pylint_django"]
vs code linting in django Therefore you need this plugin:pylint-django
Upvotes: 6