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:
- Basic of Django and its installation
- Crate your first Django Project and modify settings
- Create a database and run a local server
- Make Django application alongside models and their database tables
- Django SuperUser and admin
- Make Django URLs
- Django View Creation
- Implement HTML in your project
- Query Set
- Template tags: Add dynamic data
- Host your website online
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 :
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 :
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 :
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 :
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 :
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 ;
Now, talking about a webpage how can we forgot about urls; so let us configure one itself for our webpage.
Check out :
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 :
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.
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 :
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 :
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.
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 :
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 :
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 :
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.