πŸŽ™ Free live masterclass Β· Sun, 29 Nov, 7:00 pm IST Β· Java Full Stack roadmap Register free β†’
Skills101

Blog with Django

A complete blog with posts, categories, comments and an admin panel, built the Django way.

Beginner⏱ 10–14 hoursπŸͺœ 8 stepsPythonDjangoSQLite/PostgreSQL

What you'll learn

  • β—†Models, views, templates and URLs
  • β—†The Django admin
  • β—†Built-in authentication and forms

What you'll build

  • βœ“Post list with pagination and categories
  • βœ“Post detail with comments
  • βœ“Login to write and edit your posts
  • βœ“Admin panel for moderation

Step-by-step guide

  1. 1

    Start the project

    python -m venv venv; pip install django; django-admin startproject mysite; python manage.py startapp blog.

  2. 2

    Models

    Category(name, slug) and Post(title, slug, author FK User, category FK, body, published_at, status) and Comment(post FK, name, text, approved).

  3. 3

    Admin

    Register models with list_display, search_fields and prepopulated_fields = {"slug": ("title",)}; create a superuser.

  4. 4

    Views and URLs

    ListView with paginate_by = 10 and DetailView looked up by slug; wire them in blog/urls.py.

  5. 5

    Templates

    A base.html with blocks; extend it for list and detail; use {% url %} for links.

  6. 6

    Comments form

    A ModelForm; save comments as not approved until a moderator approves them in the admin.

  7. 7

    Auth for authors

    Use django.contrib.auth views for login; LoginRequiredMixin on Create/UpdateView; check request.user == post.author.

  8. 8

    Go live

    Switch to PostgreSQL, set DEBUG = False, ALLOWED_HOSTS, collectstatic, and run with gunicorn.

πŸš€ Make it stand out

  • +Tags with django-taggit
  • +RSS feed and sitemap (built into Django)
  • +Search with PostgreSQL full-text search