PSYCHOCODES

How to Build Simple Blogging System using Django-Part-1 Installing Django and Setting up the Environment

Django is a popular python framework used to build web applications, some of the most famous websites such as youtube, yahoo uses python's Django on their website.

Building Blogging System using Django for beginners

This is going to be a 3-4 part tutorial series in which we will learn how we can build a simple blogging system using Django before we start we will recommend you that you should know the basics of python, HTML and CSS if you have not done any of them before then please learn them first(the basics) and then proceed. 

In this series, we will cover the following topics.

  • Installing Django and Setting up your environment
  • Apps, Models and Connecting to database
  • URL routing and Views
  • Creating templates and Connecting data to templates

So let's get started, In this part of the series we will learn how to install Django and to Setup our development environment and we will give you the overview of each file present in your project folder.

Before installing Django, install python on your system from the following Download Link, after you successfully download python execute following command to check if it is correctly installed.

Also learn : How to Install and Configure Django Python Framework on Ubuntu

python --version

Run the following command to check whether you have tools installed to download Django.

easy_install --version

Now to install the latest version of Django execute the following command on the terminal

easy_install django

The above command will take some time to execute as it will download and install the latest version of Django on your system. To check if it is correctly installed on your system execute following command and check.

django-admin --version

Now you have successfully installed Django on your computer, Now we will see how to setup a new project in Django, before executing this command you first need to locate the directory in which you need to create for windows type the following command.

cd desktop

The following set the location to your computer desktop you can change your directory location if you want after setting this up we will make a new project at our computers desktop, so to do that execute the following command

django-admin startproject BlogSystem

The above command will simply create a folder naming "BlogSystem" containing some files on your desktop screen, this folder is basically your project folder if you want you can change the name but for this series, we are going to use "BlogSystem".

Now we have successfully created our project folder now let's see what each file in the folder actually means the hierarchy of the folder will be similar as shown below

BlogSystem

  • BlogSystem
          __init__.py
         settings.py
         urls.py
         wsgi.py
  • manage.py

Now let's see what each file actually is

manage.py:   First of all, I want to say to you guys that you never edit, delete or perform some kind of modifications to this file as this file is responsible for all the actions that you will perform in your project for example: creating databases, creating users, making connections etc.

__init__.py:  This file basically tells python that the folder is a python package and if you open this file in a text editor you will see that the file is actually empty because it just tells that the folder is a python package

settings.py: This file contains all the settings of your projects such as database connections, apps connection(we will talk about this later in this series), templates settings etc.

urls.py This is one of the most important files as it defines the URL structure of your website, or you can say the table of content of your website.

wsgi.py: Webserver Gateway Interface, it is basically the server which will run our website.

So that's it, in the next tutorial we will learn about URL's, apps, views and models and create each of them for our blogging system.

Thank you for reading.

Tweet your queries and feedback to @PsychoCodes or leave a message on our Facebook page. You can also comment your questions below.

Also, don't forget to subscribe to our Newsletter.

If you like this article, then please share it and help us grow.

Share your thoughts