How to create project in Django

Satoro
2 min readNov 2, 2021

Django is a web framework of python using which we can create web apps. Instead of going into the theory part, I will show you how you can create a Django project from scratch.

Let's create a new directory named djTut and in this directory create a virtual environment for our project.

If you don’t know how to create a virtual environment just follow these in your command line or PowerShell or terminal:

First of all install virtualenv using pip

pip install virtualenv

move to djTut directory and create a virtual environment named env:

virtualenv env

Now, activate our environment:

#For Windows users
env\Scripts\activate
#For Mac or Linux users
source env/bin/activate

Your environment should be activated now.

Let’s install Django inside our environment

pip install django

After Django is successfully installed let's create a project named myFirstProj:

django-admin startproject myFirstProj .

Notice that I have added a dot after myFirstProj so that it does not create an extra directory. You can play with it by creating a project without a dot and see what happens.

Now let’s run our server using:

python manage.py runserver

Go to http://127.0.0.1:8000 in the browser and see if it works. You should see something like this:

If can see something like this then congrats you have successfully created your first Django project.

Now to stop our local server and deactivate the virtual environment do:

ctrl + c in terminal

And then run this command:

deactivate

Your virtual environment should be deactivated now.

That’s all for this tutorial. I hope you liked it. Thank you.

--

--