skip to Main Content

The problem is here. Just started learning Django by following the official documentation and came across this error. Naturally, I googled it to try and find a fix, but nothing helped. Everybody is saying to choose the right interpreter, but for me the right interpreter was chosen from the start, the one in the virtual environment folder (idk if that’s how you say it, like I said I’m new so the terminology is still confusing) and it is still not working.

2

Answers


  1. This is probably well and truely resolved by now, but I suspect the problem was that the OP hand not selected the correct pyenv/venv in vscode.

    By default vscode would have been using the system python for pylance, which (if the OP was using venvs correctly) probably didn’t have Django installed. Django was probably installed in a specific pyenv/venv for the project.

    On the right side of the status bar running along the bottom of vscode you can select the python install to use for the open project, always ensure you have the correct pyenv/venv selected here to avoid pylance or lint throwing errors about library’s not being resolvable or missing.

    Login or Signup to reply.
  2. go to view in Vscode select command palette, then select python select interpreter there are two bit options. change from your current one from global or recommended

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search