How to setup Django?

Sonakshi Satpathy
Webwiznitr
Published in
3 min readFeb 24, 2021

This article comprises of the step by step process of installing Django in Windows and an overview of a Django development environment.

Django is an open-source Python web framework that helps developers create web applications with ease. The development environment is an installation of Django on your localhost that you can use for developing and testing Django apps prior to deploying them to a search engine or a production environment. This comes with a set of Python scripts for creating and working with Django projects, along with a development web server so that you can locally run your Django apps in your computer’s web browser.

Let's now dive into the installation of Django!

Django is a very flexible framework that can be downloaded from external sources but the most ideal method is to install Django through the Python Package Index (PyPi), using the pip tool and that is what we are going to cover in this article.

For this, it is very important to have the latest version of Python installed in your operating system (preferably Python 3.9). We know that in Python, there is a single global environment where all the codes are written and run, but for Django, we prefer to create a new virtual environment (venv) that will support our web application. This also allows us to have multiple Django environments on a single computer. How cool is that?🔥

Setting up a virtual environment

To create a virtual environment for your project, open a new command prompt, navigate to the Python folder where you want to create your project, and then enter the following:

py -m venv project-name

This will create a folder called ‘project-name’. In order to activate the environment, run:

project-name\Scripts\activate.bat

Now, the virtual environment has been activated and you will see ‘project-name’ next to the command prompt to assign that. But remember, that every time you start a new command prompt, you have to activate the environment again.

Installing Django

In the command prompt, ensure that your virtual environment is active. Using pip execute the command:

py -m pip install Django

After the installation, execute:

django-admin startproject project-name
python manage.py runserver

Navigate to the manage.py and type the command ‘runserver’. Once the server is running you can view the site by clicking on the following URL :

After clicking this link, on your web browser, you should see a site, that looks like this:

Yes, you are right! It is that easy to set up Django 🚀. Now you can start creating wonders with this unique and powerful framework. To use Django to the fullest refer to:

--

--