How to create project in Django

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

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

Now, activate our environment:

Your environment should be activated now.

Let’s install Django inside our environment

After Django is successfully installed let's create a project named 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:

Go to 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:

Your virtual environment should be deactivated now.

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



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store