TIL: How to force PyLance to use a current version of Django-stubs
Saturday, February 1, 2025
One of the little annoyances I encounter when I have to use Visual Studio Code, PyLance and a modern version of Django is, that PyLance shows errors for things like the login_not_required
decorator.
Today I found a workaround by chance when I once again did a web search for the topic. This StackOverflow post outlines the solution — just remove the version of django-stubs included with PyLance.
rm -rf ".vscode/extensions/ms-python.vscode-pylance-*/dist/bundled/stubs/django-stubs"