Skip to main content

Django

Pronunciation
JANG-goh
Updated 2 min read

Share this page

Send the link, quote the definition with a link back, or show it as a card on your own site.

https://softwaredictionary.org/terms/django

In short

Django is an open-source Python web framework that comes with an ORM, an admin panel, authentication and security protections, so teams can build quickly.

What is Django?

Django was created at a newspaper in Lawrence, Kansas, to build news sites on tight deadlines, and was released as open source in 2005. It follows a "batteries included" philosophy: instead of picking separate libraries for each job, you get a database layer, URL routing, templates, forms, authentication, an admin interface and caching in one coherent package.

A Django project is organized as models, views and templates. Models are Python classes that describe your data; Django's ORM turns them into database tables and lets you query them without writing SQL. Views are functions or classes that handle a request and return a response, and templates render HTML. Django calls this pattern MTV, its own version of MVC.

One of its most loved features is the automatic admin: from your models, Django generates a working back office where staff can add, edit and search data. It also protects against common attacks out of the box, including SQL injection, cross-site scripting, cross-site request forgery and clickjacking. For APIs, the Django REST Framework adds serializers and views for building REST endpoints.

A common misconception is that Django is only for small sites. It runs large services, including parts of Instagram, and scales with caching, read replicas and background workers. It is more opinionated than minimal frameworks such as Flask or FastAPI, which trade built-in features for flexibility.

Key takeaways

  • Django is an open-source, "batteries included" Python web framework.
  • Models, views and templates form its MTV structure.
  • Its ORM maps Python classes to database tables.
  • An automatic admin panel is generated from your models.
  • Built-in protections cover SQL injection, XSS, CSRF and clickjacking.

Example

A model and a viewpython
# models.py: Django creates the table from this class
from django.db import models

class Article(models.Model):
    title = models.CharField(max_length=200)
    published = models.DateTimeField(auto_now_add=True)

# views.py: query with the ORM, render a template
from django.shortcuts import render

def latest(request):
    articles = Article.objects.order_by("-published")[:10]
    return render(request, "latest.html", {"articles": articles})

Readers ask

Is Django frontend or backend?

Backend. Django runs on the server, handles requests, talks to the database and returns HTML or JSON. It can render pages itself or serve an API for a separate frontend such as React.

What is the difference between Django and Flask?

Django includes an ORM, admin, authentication and more out of the box. Flask is a microframework that gives you routing and leaves the rest to extensions you choose.

What is Django REST Framework?

A popular library on top of Django for building web APIs. It adds serializers that convert models to JSON, views for REST endpoints, authentication and a browsable API.

Often compared

See also

Spotted a mistake or something missing on this page?Suggest an edit

Read a random page
Open today's review
Switch to the dark theme
Read this page in Türkçe

More

Settings