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"...