DEV Community

Cover image for How to clone a Django project from Github and run it locally (MAC IOS).
Kachi Cheong
Kachi Cheong

Posted on

How to clone a Django project from Github and run it locally (MAC IOS).

This is a quick guide on how to clone/fork a django project from github.

Requirements

  • You will need to have a version of python 3 installed.

check this by using the following command

python3 --version
Enter fullscreen mode Exit fullscreen mode

Installation

First let's clone the git repo, click on the code and copy the url. Heres an example of where to find that url:

Example

Then open your terminal and navigate to the directory you wish to store the project and run the following commands:

git clone https://github.com/REPONAME.git
Enter fullscreen mode Exit fullscreen mode

(replace the url your own url)

Once you've cloned the repository, navigate into the repository.

Create a virtual environment and activate it using the following commands:

python3 -m venv venv
source venv/bin/activate
Enter fullscreen mode Exit fullscreen mode

Once you've activated your virtual environment install your python packages by running:

pip install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode

Now let's migrate our django project:

python manage.py migrate
Enter fullscreen mode Exit fullscreen mode

If there are no hitches here you should now be able to open your server by running:

python manage.py runserver
Enter fullscreen mode Exit fullscreen mode

Quick and painless. If there are any issues or problems, leave a comment below!

Discussion (0)