Building a Blog Application with Python 3.5 and Django 1.11.4 Web Framework


Hey everyone, my name is Henry and welcome to building a blog application tutorial with python 3 and Django web framework. I am a software developer at Muva Technologies where our main focus is to offer services around mobile solutions(Apps), web solution and websites, payments integration, web hosting and domains, and last but not least, consultancy and training.

Why create a blog application?

One of the main question developers ask is, why create a blog application tutorial? It seems like everyone recreate a blog as a first application. Well, there is a reason for that, first of all. Everyone knows how a blog works and this make it easy for learning. When I tell you we are creating a blog, you automatically know that there is some sort of authentication system, posts are going to be the main element, there will be a page that list all the post in a particular order e.g chronologically and you also know each of these post will have comments.

Simply put, when we say a blog, you are able to visualize the end goal of the tutorial and everyone is on the same page as to what a blog entails. I think those are the main reason why a blog application? and the other important reason, it does not involve anything overly complex but at the same time it will get you into some of the most important element and this will act as a stepping stone for any application in the future.

To build our blog application, we will be using a popular python web framework called Django. Django web framework is written in python and it follows python programming language style. We hope you have basic understanding of python programming, this will give you an edge in understanding this tutorial. Here are the topics that will be covered in this tutorial:

Development Environment

I have a philosophy that any time you want to create a Django web application, always use a virtual environment. Imagine that you have an application that requires python 2.7 but another application needs python 3. How can use and develop both of these application? In another scenario, imagine you have a fully developed application and you do not want to make changes to the libraries it is using but at the same time you start another application that requires the updated version of those libraries. What will you do?

Well, this is why it’s always a better programming practice to create a virtual environment. In this application we are going to create a virtual environment. Python makes creating a virtual environment easy. I have a folder on my desktop called dev. On my terminal I will navigate to this folder, to create virtual environment, just run the following command: virtualenv -p /usr/bin/python3 djablog this command will create a virtual environment using python3 and the last name djablog is the name of my virtual environment. Of course you can give your virtual environment any name.

NB: To create virtual environment on Mac OS use this link and for windows use the following link.

Before we can use our virtual environment we need to activate it, cd to djablog folder. Here is a screen shot of my terminal:

As you can see, I have created my virtual environment and navigated to my djablog virtual environment. Before we can use this environment, we need to activate it. To activate it, just run the following command: . bin/activate Here is a screen shot of the active virtual environment.

At the beginning of the line, you will see the name of your virtual environment in parentheses and that is how you know that your environment is active.

NB: Every time you work on your virtual environment, always remember to activate it.

Goals achieved in this lesson

  • We have given reason why people recreate blog as their first application.

  • We have given reason why it is important to create virtual environment.

  • We have learnt how to create python virtual environment.

  • We have also learnt how to activate python virtual environment.

With that, we conclude our first lesson, to get the code visit building a blog application. See you in lesson 2.

Facebook Comments
Get free email updates!
Signup now and receive an email once we publish new content.
We respect your privacy

Henry Mbugua

I am a Junior Developer ready to enter major leagues. My professional ambition is to stay versatile and be able to fill different roles within a product group. As such, I have been learning technology across frontend and backend.