How to create a blog website in Django – Beginner tutorial

In this Django tutorial, we are going to understand step by step how to make an introductory basic Django blog application in order to understand the few intricacies of Python-based framework. Alongside that, we would work upon the front end using HTML and would finally make the website live on the internet via hosting services.
This is a simple beginner tutorial to learn how to create a blog website in Django. The following steps will be shown step by step.

Tutorial to create a blog website in Django – Step by step

Table of contents:

  1. Basic of Django and its installation
  2. Crate your first Django Project and modify settings
  3. Create a database and run a local server
  4. Make Django application alongside models and their database tables
  5. Django SuperUser and admin
  6. Make Django URLs
  7. Django View Creation
  8. Implement HTML in your project
  9. Query Set
  10. Template tags: Add dynamic data
  11. Host your website online

Understanding Django and installing it

In order to create your blog website in Django, you need to learn some basics of it. But if you are not a beginner in Django you may skip this portion.

For the starters, Django is a python based backend web framework that handles everything that happens behind the scenes of a website you visit; such as fetching data, managing database, creating user’s credentials along with a lot more.

To understand more about it :

Basic of Django and its installation

 

Creating a new Django Project and modifying its settings

Now, that you have the framework installed on your machine. Let us learn how to create a Django project as it handles any type of functionalities in the form of separate projects to keep it clean and easy to use.




Have a look at the link below :

How to create your Django project and modify its settings. (Part II)

 

Creating a database and running Local server

A crucial aspect of a website’s backend part is the database to store the information that is going to be shown up on the website- be it static or dynamic. Also creating the database will complete the basic structure of our website; so let us also run it locally on our own machine-to make things real.

For that, check out :

Setting up Database for Django project and running Server(Part III)

 

Creating Django application alongside Django models

Django application is a part of our project just like a webpage is of a whole website. Along with that, it is also necessary to learn how to create models (frameworks) for creating the various elements of a website in order to reuse them when implementing objects of the same type.

To create one, have a look at :

Creating Django Application and Introduction to Django Models(Part IV)

Alongside, creating models it is also necessary to store them in the database; so that the next time they got implemented automatically reducing the hassle of linking them every time.

To accomplish that, take a read at :

Creating Django Models and their Tables in the database(Part V)

 

Maintaining Django Admin section

A good thing about this framework is that it provides an admin page to control all the users of the website; and handling all the rights given to each of them.

To understand it better, have a look at ;

How to create a Django SuperUser and a look at Django Admin (Part VI)

 

Creating Django URLs

Now, talking about a webpage how can we forgot about urls; so let us configure one itself for our webpage.

Check out :

What are Django URLs and How to create them(Part VII)

 

Creating Django views

Views are something which relates the data stored in the database to the models we have just created. So let us know more about them and create them :

Introduction to Django Views and how to create them(Part VIII)

 

Implementing HTML

Now, that we have a basic static webpage ready with the backend portion; let us beautify it. The key to improving the user experience and interactivity is with the front end technologies, but since we are focusing on the backend framework here we are just using HTML in this project.

Introduction to HTML and creating your First Template(Part IX)

 

Introduction to QuerySet

The static webpage we have created is a bit boring; what about adding some dynamic data to it. Well, turns out this framework even provides support for it and QuerySet is here for our rescue.

Learn more about them here :

What is Django QuerySet and to execute one? (Part X)

Filter and order objects along with publishing them using QuerySet in Django(Part XI)

 

Working with Django templates

Even though, we have added the support for dynamic data with QuerySet; still, the webpage is showing the same old static data. Wait, we haven’t added the support for dynamic data in the templates.

Learn it here :

Django Template tags: Add Dynamic data through Django Template Tags? (Part XIII)

 

Taking the website online

Have finally created a basic web application; but what fun would it be if the world doesn’t have a look at it.

Installing Git

Git is a version control system to take care of all the past changes you make on the website; so that it also get implemented on the one you will host on the internet.

Learn more about it at :

Introduction to Git and creating your Git repository

Working with Github

To take our website online; we need to share the code for it online, and Github is the best solution you can get for it. So, let us learn the intricacies of Github :

What is GitHub and How to push your code on GitHub?

Updating the website on pythonanywhere.com

Finally, let us take our website online with the free hosting service provided by pythonanywhere.com. Set up for a new account and follow the instruction given at :

How to host your Web Application on PythonAnywhere.com

 

And here you go, your own website is live!

Hope this tutorial helped you to understand how easily you can create a blog website in Django.

Feel free to drop any queries you face in the whole procedure.


Leave a Reply

Your email address will not be published. Required fields are marked *