Introduction to Django

Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of web development.

Why Choose Django?

  • Batteries included — comes with an ORM, admin panel, and authentication
  • Security — protects against common vulnerabilities like SQL injection and XSS
  • Scalability — powers sites like Instagram and Pinterest

Your First Django Project

To create a new Django project, run the following command:


# Install Django
pip install django

# Create a new project
django-admin startproject mysite

# Run the development server
python manage.py runserver

Creating Your First View

Here is a simple view that returns a greeting:


from django.http import HttpResponse

def hello(request):
    return HttpResponse("Hello, Django!")

For more information, visit the official Django documentation.