DRF Setup

Requirements for Django REST Framework

To work with DRF, make sure you have the following installed:
Operating System : Windows

Python : 3.8 or higher (e.g., 3.8, 3.9, 3.10, 3.11, 3.12, 3.13)
Django : 4.2 or higher (e.g., 4.2, 5.0, 5.1)

Note: It is always recommended to use the latest stable versions of Python and Django for better support and security.

Basic Django REST Framework Setup

Step 1:Create a virtual environment inside a new folder

Open terminal and run the following commands:

python -m venv menv
Django-

This will create your virtual environment folder

Step 2:Activate virtual environment

menv\Scripts\activate

This will activate your virtual environment

Step 3: Install Django Rest Framework

pip install djangorestframework

This will install latest version of your Django Rest Framework.

django-admin startproject bookstore

Step 4:Start Project

django-admin startproject bookstore
Django-Start-project

Step 5: Start app

Python manage.py startapp books
Django-Start-up
Djang-start-app--

Register your App to settings.py.

Django-start-app---

A Django App is like a small module or component in a Django project.
Each app is designed to do one specific task like managing books, users, blog posts, products, etc.

Step 6:Run server

python manage.py runserver
Django-Run-server

By running this command you will be able to navigate you to your development server.

Starting development server at:  http://127.0.0.1:8000/.

Step 7:Make migrations

python manage.py migrate
Django-make-migrations

Why do we migrate right after setting up a Django project?

When you create a new Django project, Django already includes some built-in apps like:

  Authentication system (auth)
  Admin panel (admin)
•  Session handling (sessions)
  Content types (contenttypes)

These built-in apps have their own models (like user, group, permissions), but their database tables are not created automatically.

This command creates all the necessary tables so that these built-in features work properly.

Step 8:Create Superuser

python manage.py createsuperuser
Django-create-superuser

Now ,You are able to see your admin panel on IP  http://127.0.0.1:8000/admin using above user and password.

Course Video in English