Clone and Run a Django Project from Github

Hi, Everyone

When we clone a Django Project from Github or we copy from anywhere, we are not able to run that project on our system. So in this post, I will tell you how to run that file into your local system.

The reason why we are not able to run that is that the SECRET_KE present in that the cloned file’s manage.py and the key generated by the Django while installation is different.

Before diving let’s look at the things we are required to install in our system.

  • Github Desktop / Git Bash
  • Python 3

To run Django prefer to use the Virtual Environment

pip install virtualenv

Making and Activating the Virtual Environment:-

virtualenv “name as you like”

source env/bin/activate

Installing Django:-

pip install django

Now, we need to clone any Django project from Github:-

For the Github Desktop user:- just put the git URL and press clone.

For the Git Bash user:-  git clone “the git URL”

After finishing the cloning part let’s move to the main Django run part.

Install the project dependencies:

pip install -r requirement.txt

Make a demo project just to copy the SECRET KEY generated by Django.

To create follow the steps below:-

  • open CMD and type django-admin startproject “name of the project”

  • Now go to the setting.py and copy the SECRET_KEY.

  • Navigate to the cloned folder and open the setting.py and paste the copied SECRET_KEY.
  • Then open the cmd in that folder and do the migration part and also create the superuser by the following commands.

Now the last thing is that just go to the cloned project and run the project by writing the following command in the CMD.

python manage.py runserver 

Thanks

One response to “Clone and Run a Django Project from Github”

  1. Lavisy Rand says:

    Very helpful and clear tutorial. Short but easy to read and understand.

    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *