I have just installed the Djangorestframework in my Django project for the first time. Before installing all the required dependencies (djangorestframework being one of them), I created a virtual environment (venv) were my project can run. Also I have created a virtual server where my project runs using Vagrant (ubuntu/bionic64).
我安装了 Django 3.2.10、django-rest-framework 3.12.4 和 python 3.6.9
So after all this configurations when i try to import some classes from django-rest-framework and registered the "rest_framework" in INSTALLED_APPS in the settings.py, the imported commands are underlined using yellow lines. For example:
从rest_framework.views import APIview,短语“rest_framework”带有黄色下划线,可能是什么问题?
我尝试了几种解决方案,但没有效果
好的,这是您的 VSCode 项目的配置问题。这不是您的应用程序中的实际问题。
它很可能与为您的项目配置的“解释器”有关。您应该使用 venv 中的 Python 实例。