by Mohd Shibli
Posted on 24 January 2017
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.
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.
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.
Run the following command to check whether you have tools installed to download Django.
Now to install the latest version of Django execute the following command on the terminal
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.
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.
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
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.
Also, don't forget to subscribe to our Newsletter.
If you like this article, then please share it and help us grow.
Preorder and Postorder Traversal of binary tree in Python
02 September 2018
Binary Tree in Python
02 September 2018
Explaining Register variables in C with examples
17 August 2018
Data Autosave System using PHP, MySQL and AJAX
06 July 2018