Why I switched to Django over any other framework?

In this article, I’ll discuss my recent web development using Django and if you’re new to this website, let me give you a short brief.

Why Django?

In terms of full-stack web development, Django gained so much popularity in the industry. And due to its architecture (raid development, clean design & high security), many technologist giant companies like (YouTube, Netflix, Facebook, Instagram, UBER & many more) are running on the Django web framework. The framework comes with a toolkit that saves lots of time for the developers and allows them to reuse the same components every time. Developers spent only time building new modules that will be unique throughout the development. Django is free and open-source with vast community support that helps developers to build web application faster & secure also contribute to the open-source community.

  • How Django provides security protection?
  • What is Django MVT (Models Views Templates) design pattern?
  1. Cross-site request forgery (CSRF)
  2. SQL injection
  3. Clickjacking
  4. SSL/HTTPS
  5. Host header validation
  6. Referrer policy
  7. Session security
  8. User-uploaded content
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
  1. Security Middleware
  2. HTTP Middleware
class Blog(models.Model):
title = models.CharField(max_length=100, blank=True)
blog_id = models.CharField(max_length=100, blank=True)
author = models.CharField(max_length=100, blank=True)
published_date = models.DateTimeField(auto_now_add=True)
last_updated_date = models.DateTimeField(auto_now=True)
seo_thumbnail = models.CharField(max_length=500, blank=True)
small_thumbnail = models.CharField(max_length=500, blank=True)
thumbnail = models.CharField(max_length=500, blank=True)
keywords = ArrayField(models.CharField(max_length=100),
blank=True)
highlights = models.TextField(blank=True)
description = models.TextField(blank=True)
visibility = models.BooleanField(default=False)
is_featured = models.BooleanField(default=False)
featured_board = models.BooleanField(default=False)
featured = models.TextField(blank=True)
CREATE TABLE public.blogs_blog (
id serial NOT NULL PRIMARY KEY,
title character varying(100) NOT NULL,
blog_id character varying(100) NOT NULL,
author character varying(100) NOT NULL,
published_date timestamp with time zone NOT NULL,
last_updated_date timestamp with time zone NOT NULL,
seo_thumbnail character varying(500) NOT NULL,
small_thumbnail character varying(500) NOT NULL,
thumbnail character varying(500) NOT NULL,
keywords character varying(100)[] NOT NULL,
highlights text NOT NULL,
description text NOT NULL,
visibility boolean NOT NULL,
is_featured boolean NOT NULL,
featured text NOT NULL,
featured_board boolean NOT NULL
);
from django.shortcuts import render

def index(request):
return render(request, 'index.html')
  1. Second, we defined an index function that takes the request object as an argument which is nothing but an HTTPRequest object.
  2. Third, the index function is a view function that returns the HTTPResponse object.
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
  1. Portfolio
  2. Youtube

Python | Application Security | Web Security | Cybersecurity | Software Development