unresolved import 'rest_framework' after installing djangorestframework - django

I saw similar posts created before, but nothing helped me in the end.
I am using Python 3.7.7 and my IDE is VSC.
I installed pip install djangorestframework (both in my virtualenv and outside of it)
Added 'rest_framework', to INSTALLED_APPS. I did this by command pip install djangorestframework
Now, to used djangorestframework, I created a file serializer with from rest_framework import serializers
Now, rest_framework becomes underlined with the message unresolved import 'rest_framework'.
The whole app still works, there is no error in the console.
What would you advise me to do?
Thanks!

It sounds like VSC doesn't see that you have rest_framework installed. I would try re-setting up your Python Interpreter. Hopefully, you're using some kind of virtual environment that you can tell VSC to look at for all your dependencies.
Using Python Environments in VS Code

I turned off and on the VSC and it worked

Related

cant import flask-wtf after install

I have been looking around for an answer to this question, but everywhere I see the advice of running a pip install flask-wtf in the virtual environment. The requirements have already been satisfied in mine, but for some reason I am getting a missing module error. I am working on a school project building a website using flask and would really appreciate the help. My import is:
from flask_wtf import Form`
When I try to run the install command I get a message that says the requirement is already satisfied, as shown in this image.
Based on the screenshot, your flask-wtf and friends are installed outside virtualenvs, in the system site-packages directory.
It'd be a good idea to uninstall those from the global site-packages directory (python3 -m pip uninstall flask-wtf wtforms flask jinja2 click werkzeug markupsafe itsdangerous), create and activate a virtualenv (python3 -m venv my_venv and ./my_venv/bin/activate), then reinstall the dependencies within the virtualenv.

I cannot found modules in Django

I'm trying to connect my Django with my MongoDB.
So, first of all, I install this:
pip install djongo
And all go fine, no errors.
But If you see my models.py archive:
It's like Django it's not finding and I can't import the models.
I tried to install again Django, but it says to me that it's already installed.
I think I'm installing this in another path or something like that, but I don't know how to solve this.
My Django archive its in C:\PROYECTOS\PageSpeed_Insights__Selenium-Python\miweb
It seems that you are installing djongo in your virtualenv paginaweb, you have to configure PyCharm (or whatever IDE you are using) to look for the packages in that virtualenv, here you can see how to do it for PyCharm. It should work after that.

ModuleNotFoundError: No module named 'push_notifications' I am getting this error after I've uninstalled the module django push notification

snap of error is here which I am getting while I am migrate
First I've installed this package using pip install django-push-notifications
after that I've removed this package through pip uninstall django-push-notifications after that when I've tried migrating this. I am getting this error
You have uninstalled the module, therefore Django could not find it. Thats why it's giving error.
If you have uninstalled the module, please remove push_notifications present in INSTALLED_APPS of your settings.py file
Check, if you still have it registered in your Installed_Apps in settings.py. If so remove it.
If its not in the installed_apps then check your URLCONF --> project/urls.py if there's any url related to it.

Django REST Framework Import Error

I'm trying to install Django REST framework and I keep getting:
No module named 'rest_framework'
I've added:
'rest_framework' to my INSTALLED_APPS = []
I installed through pip3 and it still doesn't seem to be working.
This should not be the case. You might have installed globally or inside virtualenv.
Always installed your dependencies inside a virtualenv.
I think best way to get it working.
source <virtualenv>/bin/activate
pip install djangorestframework
Next whenever you work with your project re-enable back virtualenv.

No module named 'chartit';

I am trying to use chartit in django and in its documentation it says add chartit to INSTALLED APPS in "settings.py".
When I try to do that, it gives this error:
ImportError: No module named 'chartit'
How do I import it?
Thank you.
PS-Sorry, it's a silly question.
You missed installing it with pip install django_chartit.
EDIT:
The error you described is thrown by python if a module is not found in the running environment. You need to make sure, that you've installed it in the environment that is used by your django.
Try typing pip list in the shell you usually use to kick your django with python manage.py runserver to figure out what is installed there.
If your django lives inside of a IDE like PyCharm - you need to check the project settings there for the environment used to launch django.
As you don't use virtualenv (which is highly recommended) you install your modules system wide. If you are on linux there might be python3 and python (which is python 2). If your pip belongs to python2 and you have installed django in python3 or vice versa this might be the issue.
from chartit import DataPool, Chart