in windows
from rest_framework import serializers
is working. but in 'view.py' file
from rest_framework.response import Response
is not working.
please help!
I checked 'setting.py' file, pip list and runserver state.
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'mood',
'rest_framework',
]
$ pip list
Package Version
--------------------- -------
asgiref 3.3.1
Django 3.1.6
pip 21.0.1
Python-Rest-Framework 0.3.14
pytz 2021.1
setuptools 41.2.0
six 1.15.0
sqlparse 0.4.1
(venv)
ModuleNotFoundError: No module named 'rest_framework.response'
what should i do......
You have installed python-rest-framework
not django-rest-framework
. your import statements are correct, but not the installed package.
Python-Rest-Framework 0.3.14
Use this to install DRF:
pip install djangorestframework
You Should Install Django REST framework but you have Installed Python Rest framework. To install Django Rest framework please Install the rest framework with below code.
pip install djangorestframework
pip3 install djangorestframework
i used this command on windows and it is solved
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.