Django REST framework
DRF is an open source Python library that can be used to develop REST APIs for a Django project. DRF has most of the necessary functionality built in to help develop APIs for any Django project. Throughout this chapter, we will be using it to develop APIs for our Bookr
project. In the following section, we will install and configure DRF.
Installation and configuration
To install djangorestframework
in the virtual
environment
setup along with PyCharm, follow these steps:
- Enter the following code in your Terminal app or Command Prompt to do this:
pip install djangorestframework
- Next, open the
settings.py
file and addrest_framework
toINSTALLED_APPS
as shown in the following snippet:INSTALLED_APPS = [ "bookr_admin.apps.BookrAdminConfig", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions"...