Open In App

Clone and Run a Django Project from Github

Last Updated : 04 Sep, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

In this article, we will learn how to download any project from GitHub and deploy it to our local machine. You can clone any code or project from GitHub but for this article, we are cloning our Django project.

What is GitHub?

GitHub is an online platform where we can share our codes(or projects) online hassle-free, we can also host our local git repository online. It basically allows you to work collaboratively with a group of people. 

Terminal Command to Clone Django Project from GitHub

git clone <URL of GitHub repository>

e.g.,

git clone "https://github.com/Hardik-Kushwaha/Face-Detection-Minor1"

What is Django?

A Python-based web framework called Django enables you to quickly build effective online apps. Because Django has built-in features for everything, including the Django Admin Interface and the default database, SQLlite3, it is often known as a batteries-included framework.

Clone a Django Project from GitHub and Run

Install and Create a Virtual Environment

Step 1: Create a virtual environment.

Unix/Linux/macOS users run the following command 

python3 -m venv env

Windows users run the following command

py -m venv env

Step 2: Activate the virtual environment and verify it

Unix/Linux/macOS users run the following command 

source env/bin/activate

Windows users run the following command

.\env\Scripts\activate

If you have trouble in creating or activating the virtual environment refer to this article.

Run a Django Project from Github

Clone a GitHub Repository  

Copy the URL of the GitHub repository if you want to clone it in the tutorial we are using this repository. Run the git clone command in the terminal or git bash to clone the repository.

Syntax: git clone "URL of GitHub repository"
git clone "https://github.com/Hardik-Kushwaha/Face-Detection-Minor1"

Run a Django Project from Github

Deploy Django Project from GitHub

After the repository is cloned successfully change the directory to the recent clone repository in which the Django project is kept.

cd Face-Detection-Minor1

Install the requirements (if any). Most of the projects have requirements.txt file which specifies the requirements of that project, so let’s install the requirements of it from the file.

pip install -r requirements.txt

Note: If the project don’t have the requirement.txt file you have to install requirements Individually which are required for the project. e.g., Django,python etc.

Run a Django Project from Github

Run the Django server by running the below command.

python3 manage.py runserver

Run a Django Project from Github

Go to the web browser and enter http://127.0.0.1:8000 to verify whether the application is running fine or not.

Output:

Run a Django Project from Github


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads