Introduction to Django Framework and How to install it ? (Part I)
In this tutorial, we are going to learn about the Python-based Django web framework – its features, benefits and usability. Further, we will also look at how to install Django on our machine.
(This tutorial is a part of an introductory Django series where we are going to learn how to make a basic Blog web application and host it.)
Link- Tutorial series to create blog website using Django
What is Django?
Django is a Python-based free and open-source web framework, which follows the model-view-template (MVT) architectural pattern.
Django eases the procedure of creating a complex database driven website; handling all the dependencies, providing a pre-built admin interface and pre-defining all the other components required to run a website.
Features of Django
- Security: Django helps to avoid common security mistakes, such as SQL injection, cross-site scripting, cross-site request forgery and clickjacking. Its admin system provides a way to manage user accounts and passwords.
- Versatility: Django can be used to build an unending list of technologies from content management systems to social networks to scientific computing platforms.
- Portability: Since Python is an OS independent language, Django being based on Python can be run on any machine including Windows, Linux and Mac OS.
Installation of Django in Python
(Make sure to have Python3.x.x already installed on your machine)
Creating a Virtual Environment :
python3 -m venv codespeedy_venv
where ‘codespeedy_venv’ is the name of the virtual environment.
Working with Virtual environment :
For Windows:
codespeedy_venv\Scripts\activate
For Linux/Mac OS:
source codespeedy_venv/bin/activate
Installing Django:
Before that install the latest version of pip, using the command :
python -m pip install --upgrade pip
Installing Required Packages :
Create a requirements.txt file in the home directory and add to it :
Django~=2.0.6
Now, in the Command line/ Terminal execute :
pip install -r requirements.txt
That’s it! Now you finally have Django running on your machine.
We hope you are now able to install Django in Python easily.
Next Part of this tutorial: How to create your Django project and modify its settings. (Part II)
If you face any problem installing Django please let us know in the below comment section.
You may also learn,
Leave a Reply