open terinal on code editor(in my case VScode), check python version
python --version
install django
pip install django djangorestframework
install postgre
pip install psycopg2
create project folder
django-admin startproject <your project name>
change directory to you project
cd <your_project/>
create api folder
python manage.py startapp api
1.update under INSTALLED_APPS section
'rest_framework',
'api'
2.update DATABASES = section
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'postgres', # Replace with your database name
'USER': 'postgres', # Replace with your PostgreSQL username
'PASSWORD': '.*******', # Replace with your PostgreSQL password
'HOST': 'localhost', # Typically 'localhost' or '127.0.0.1'
'PORT': '5432', # Default PostgreSQL port
}
1.code models.py
2.in code editor terminal migrate process
python manage.py makemigrations
python manage.py migrate
3.add/create file called under api serializer.py code
4.code file callled views.py under api
5.add/create file called under api urls.py code
1.update/edit file called urls.py
python manage.py runserver