What is Django?
Django is a high-level, open-source Python Web development framework used for building rapid maintainable websites with clean pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. Django was built by Adrian Holovaty and Simon Willison at Lawrence Journal-World newspaper back in 2003-2004. The whole story of why and how they built Django is answered by Simon Willison on a Quora post.
Why Django?
Administrative GUI - One of the most powerful parts of Django is the automatic admin interface. It reads metadata from your models to provide a quick, model-centric interface where trusted users can manage content on your site.
Object Relational Mapping (ORM) Support - Django provides a bridge between the data model and the database engine, and supports a large set of database systems including MySQL, Oracle, Postgres, etc.
Development Environment - Django comes with a lightweight web server for an end to end application development and testing.
Installing Django
Assuming you already have the latest version of Python installed on your machine, we go ahead and create a virtual environment.
Virtual Environment
A virtual environment is a python module that creates a unique environment for each project or task, having its own version of python modules required to run the specific project or tasks.
Installing and creating a virtual environment
We can install a virtual environment by using the Python Package manager pip
.
pip install virtualenv
Having installed virtualenv, the next step is to create a virtual environment.
python3 -m venv <virtual-environment-name>
Now a virtual environment is created. We have to implicitly activate the virtual environment each time we use it. We can do that by using the command
source venv/bin/activate
Now the virtual environment setup has been completed. We can go ahead and install Django onto our machine by again using the Python Package manager pip
and verify it by typing the following command.
pip install Django
python -m django --version
If Django is successfully installed you should be able to see the version of Django installed. If it throws an error then you see the official documentation here.
That's it for this tutorial. We will see how to start a Django project and create apps inside our Django project in the next tutorial.
Top comments (2)
Nice article
Btw you can also use virtualenvwrapper for creating and managing various virtual envs. Also it keeps venv directory outside out project dir.
Thank you. I did not know about virtualenvwrapper. I'll probably add that to this article later today.