Django Tutorial for Beginners

Interested in web development but don’t know where to start? You’ve come to the right place! In this tutorial, I will show you how to create your own blog using Python and Django.

You can also download the source code for this tutorial if you want:

Getting Started

Let’s start by making some preparations, install the necessary software, create a new Django project, and then, we need to talk about the MVC structure, or in this case, the MTV structure, which is commonly used by most of the web frameworks.

Database

One of the most important steps of web development is to design the database structure. In this tutorial, we’ll make four database tables together.

The users table stores the user name, email and password. The migration file for this table is already included in Django. The categories and tags tables store the category names and tag names. And finally, the posts table stores the post title, content, post image and so on.

Admin Panel

Every website requires an admin panel where you can update new content on your website.

Routes, Controllers and Views

Routes are the entry points when someone visits your blog. They receive URLs and returns controllers. Views retrieve data from the database through models and put them in templates.

Templates are what we actually see in the browser, so they do look like HTML and CSS. However, things are more complicated than that.

Deploy

Now we can finally deploy our site.

Digging Deeper

If you want more functions for your blog, check out this post.