I trying to setup DJango restframework in a windows machine and I get the following error when I run the code,
Steps done.
Using easy_install I installed all the packages.
Here is the confirmation msg,
C:\Python27\Scripts>easy_install django-rest Searching for django-rest Best match: django-rest 0.0.1 Processing django_rest-0.0.1-py2.7.egg django-rest 0.0.1 is already the active version in easy-install.pth
Using c:\python27\lib\site-packages\django_rest-0.0.1-py2.7.egg Processing dependencies for django-rest Finished processing dependencies for django-rest
Created a new project firstwebservice which created all the files.
Edited settings.py file and included django rest as given below,
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
# Uncomment the next line to enable the admin:
# 'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
Ran the project
Error:-No module named rest_framework...
Django REST framework (DRF) is a powerful and flexible toolkit for building Web APIs. Its main benefit is that it makes serialization much easier. Django REST framework is based on Django's class-based views, so it's an excellent option if you're familiar with Django.
REST is a loosely defined protocol for listing, creating, changing, and deleting data on your server over HTTP. The Django REST framework (DRF) is a toolkit built on top of the Django web framework that reduces the amount of code you need to write to create REST interfaces.
is rest_framework actually installed and on your PYTHONPATH?
That looks like a basic import error.
Suggest you:
Double check everything's installed correctly, by running "manage.py shell" and trying both "import rest_framework" and "from rest_framework import authtoken".
I would install with pip not easy if you can, easy has given me many issues like this before.
sudo pip install djangorestframework
You're installing the wrong package. The package is named djangorestframework
, not django-rest
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With