(DRF) Django Rest Framework
🔹 About Me I am an Engineer with 2+ years of experience in Software,python automation,linux server and Networking at Tata Communications. Currently, I am transitioning my career into DevOps and Site Reliability Engineering (SRE) with hands-on knowledge of Docker, Ansible, Jenkins, Git, CI/CD pipelines, and AWS Cloud. Key contributions include automating data gathering using Python (Selenium), developing and maintaining web portals with Django and PHP, and managing Linux server environments (Red Hat Enterprise Linux 8.7). My networking expertise spans complex troubleshooting and configuration of routers and switches (Juniper, Cisco, Huawei), with hands-on experience in routing protocols (OSPF, BGP), VLANs, MPLS, VPN, and SD-WAN technologies. I am passionate about automation, cloud infrastructure, and reliability engineering, and I am actively seeking DevOps / Site Reliability Engineer opportunities where I can contribute, learn, and grow. 📌 Skills: AWS | Docker | Ansible | Jenkins | Git | CI/CD | Linux | Python | Networking | Fortinet | 📌 Certifications: CCNA Cisco Fortinet Firewall NSE4 AWS Cloud Practitioner Certification Devops skillsup from GFG
I personally use and recommend you for use the bellow tools while developing Django Projects:
Git Bash Command Line Interface for Windows
Visual Studio Code IDE for writing code
Postman for Checking API’s
Step 1: Create a Virtual Environment
# On Windows
python -m venv venv
# On macOS/Linux
python3 -m venv venv
Activate the virtual environment:
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate
Step 2: Install Django and Django Rest Framework
pip install django
pip install djangorestframework
Step 3: Create the Django Project
django-admin startproject mydrfproject .
Step 4: Create a Django App
python manage.py startapp myapp
Step 5: Configure the Project Settings
# mydrfproject/settings.py
INSTALLED_APPS = [
# ...
'rest_framework',
'myapp',
# ...
]
Step 6: Create a Simple API View
# myapp/views.py
from rest_framework.views import APIView
from rest_framework.response import Response
class HelloWorldAPIView(APIView):
def get(self, request):
return Response({"message": "Hello, world!"})
Step 7: Define URL Patterns
# myapp/urls.py
from django.urls import path
from .views import HelloWorldAPIView
urlpatterns = [
path('hello/', HelloWorldAPIView.as_view(), name='hello_world'),
]
Step 8: Configure the Project URLs
# mydrfproject/urls.py
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include('myapp.urls')),
]
Step 9: Run the Development Server
python manage.py runserver
Visit http://localhost:8000/api/hello/ in your web browser or use tools like curl or Postman to send GET requests to the API endpoint. You should receive a JSON response: {"message": "Hello, world!"}.