Blog Application In Django With Source Code

Blog Application In Django With Source Code

A Blog In Django contains all the features of a Blog site like login/register into the system, add blog post with title, description and image and edit or delete the blog post. In this tutorial will teach you on How To Create A Blog In Django

Creating A Blog In Django has interactive UI design using which users can see what others are posting. It also has an admin panel through which all the blog posts and users can be managed.

This Blog Application In Django also includes a downloadable Project With Source Code for free, just find the downloadable source code below and click to start downloading.

To start creating a Blog Application In Django, makes sure that you have PyCharm Professional IDE Installed in your computer.

About ProjectProject DetailsDefinition
Project Name Blog Application In DjangoThe Blog Application In Django is developed using Python DjangoHTML,CSS and JavaScript, This Django Blog Application is a complete blogging site for the users where users can add, edit and delete their blogs and share to everyone on the world.
Python version (Recommended)3.8 VersionPython 3.8 introduces some new syntax to the language, as well as a few small modifications to existing behavior and, most importantly, a slew of performance improvements, following in the footsteps of the previous 3.7 version.
Programming Language UsedPython Django LanguageDjango is a high-level Python web framework for building safe and maintainable websites quickly. Django is a web framework built by experienced developers that takes care of a lot of the heavy lifting so you can focus on developing your app instead of reinventing the wheel.
Developer Name itsourcecode.comFree projects containing source code in Java, PHP, Python, Django, VB.Net, Visual Basic, C, C++, C#, Javascript, and other languages are available on this website.
IDE Tool (Recommended)Sublime, Visual Studio, PyCharmSublime Text is a source code editor that is available for purchase. It comes with built-in support for a variety of programming and markup languages. Plugins, which are often community-built and maintained under free-software licenses, allow users to extend the functionality of the system. Sublime Text has a Python API to help with plugins.
Project Type Web ApplicationA web application, unlike computer-based software programs that operate locally on the device’s operating system, is application software that runs on a web server. The user uses a web browser with an active network connection to access web apps.
DatabaseSQLiteSQLite is a programming language that is used to create embedded software for devices such as televisions, cell phones, and cameras. It can handle HTTP requests with low to medium traffic. SQLite has the ability to compress files into smaller bundles with less metadata. SQLite is a temporary dataset that is used within an application to process data.
Blog Application In Django Overview


To perform this python django project make sure that you have knowledge in the following:

  • CSS
  • HTML
  • Javascript
  • Database Management

Features Of This Blog Application In Django

  • Manage Blog – In this feature includes the CRUD operation in a blog or content you create like adding, editing and deleting content of the blog
  • Login System – In this feature the admin can login to the system and manage all the feature of the system.

In This Blog Application In Django Consist Of The Following Method:

  • Blog – In this method which is the main method of the system.
  • Media – In this method which you can found all the media that you are upload in the system.
  • Template – In this method which is the design of the system that consist of HTML,CSS and JavaScript.

Steps on how to create a Blog Application In Django With Source Code

Blog Application In Django With Source Code

  • Step 1: Open file.

    First , open “pycharm professional” after that click “file” and click “new project“.
    blog application open file

  • Step 2: Choose Django.

    Second, after click “new project“, choose “Django” and click.
    blog application create django

  • Step 3: Select file location.

    Third, select a file location wherever you want.
    blog application file location

  • Step 4: Create application name.

    Fourth, name your application.
    blog application application name

  • Step 5: Click create.

    Fifth, finish creating project by clicking “create” button.
    blog application create project

  • Step 6: Start of coding.

    you are free to copy the following codes below in the given modules and method required.

The List Of Module Given Below Are Under The “Blog” Method

  • The Code Given Below Is For The “” Module – you can add the following code below into your “” under the “Blog” method.
from django.shortcuts import render, get_object_or_404, redirect
from django.utils import timezone
from .models import Post
from .forms import PostForm

def post_list(request):
    posts = Post.objects.filter('published_date')
    return render(request, 'blog/post_list.html', {'posts': posts})

def post_detail(request, pk):
    post = get_object_or_404(Post, pk=pk)
    return render(request, 'blog/post_detail.html', {'post': post})

def post_new(request):
    if request.method == "POST":
        form = PostForm(request.POST, request.FILES)
        if form.is_valid():
            post =
   = request.user
            post.published_date =
            return redirect('post_detail',
        form = PostForm()
    return render(request, 'blog/post_edit.html', {'form': form})

def post_edit(request, pk):
    post = get_object_or_404(Post, pk=pk)
    if request.method == "POST":
        form = PostForm(request.POST, request.FILES, instance=post)
        if form.is_valid():
            post =
   = request.user
            post.published_date =
            return redirect('post_detail',
        form = PostForm(instance=post)
    return render(request, 'blog/post_edit.html', {'form': form})

In this module which is the index module of the blog method.

  • The Code Given Below Is For The “” Module – you can add the following code below into your “” under the “Blog” method.
from django.conf.urls import url
from django.contrib.auth import views as auth_views

from . import views

urlpatterns = [
    url(r'^$', views.post_list, name='post_list'),
    url(r'^login/$', auth_views.login, {'template_name': 'blog/login.html'}, name='login'),
    url(r'^post/(?P<pk>\d+)/$', views.post_detail, name='post_detail'),
    url(r'^post/(?P<pk>\d+)/edit/$', views.post_edit, name='post_edit'),
    url(r'^post/new/$', views.post_new, name='post_new'),

In this module which is the URL configuration module under blog method.

  • The Code Given Below Is For The “” Module – you can add the following code below into your “” under the “Blog” method.
from django.db import models
from django.utils import timezone

class Post(models.Model):
    author = models.ForeignKey('auth.User', on_delete=models.CASCADE)
    title = models.CharField(max_length=200)
    text = models.TextField()
    image = models.ImageField("Image", blank=True, null=True, upload_to="images/")
    created_date = models.DateTimeField(
    published_date = models.DateTimeField(
            blank=True, null=True)

    def publish(self):
        self.published_date =

    def __str__(self):
        return self.title

In this module which you can found classes to be call under blog method.

I have here the list of Best Python Project with Source code free to download for free, I hope this can help you a lot.

Downloadable Source Code Below.

Anyway, if you want to level up your programming knowledge, especially python, try this new article I’ve made for you Best Python Projects with source code for Beginners. But If you’re going to focus on web development using Django, you can download here from our list of Best Django Projects with source code based on real-world projects.

How To Run The Blog Application In Django?

Step 1: Extract/unzip the file

Step 2: Go inside the project folder, open cmd and type the following commands to install Django Framework and run the webserver:

1.) python runserver

Step 3: Finally, open the browser and go to localhost:8000


The system is built fully in Django Framework in back-end and HTML, CSS in front-end. It has full-featured user interface with all the functionalities

This Article is the way to enhance and develop our skills and logic ideas which is important in practicing the python programming language which is most well known and most usable programming language in many company.

Related article below


If you have any questions or suggestions about Blog Application In Django, please feel free to leave a comment below.

Leave a Comment