Cannot auto import Django classes in VS Code despite changing package index depth

I installed Python 3.13 in C:/_dev/ folder.

I have created a Python virtual environment in another folder and installed Django, then I generated a Django project and an application.

I wanted to make a custom User model. When I typed class CustomUser(AbstractBaseUser), AbstractBaseUser was not suggested and imported. When I pressed Ctrl+. on AbstractBaseUser nothing was suggested too.

from django.db import models

# Create your models here.
class CustomUser(AbstractBaseUser): // from django.contrib.auth.models import AbstractBaseUser
    pass

I changed package index depths both in workspace and user settings.

"python.analysis.packageIndexDepths": [{ "name": "django", "depth": 5 }]

Nothing was still suggested.

How do I solve the problem? I also tried restarting VS Code, but that didn't work.

Вернуться на верх