Unlock the Power of Django: A Concise Step-by-Step Guide to Setting Up and Creating Your First Project on macOS
Check if Python is installed :
python3
If not installed, please install:
brew install python3
If you don’t have brew installed, you can install using the command below and re-run the command above to install python3
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After that, create a virtual environment in your preferred directory, cd to your preferred directory, and run the command below:
python3 -m venv testenv
the ‘testenv’ is the virtual environment name, you can give it your preferred name
Once your new environment has been created, cd into it
Once, you are inside your new environment directory, activate the new virtual environment and install Django:
to activate run:
source bin/activate
Once you active the virtual environment, the command prompt will have a prefix with your virtual environment name, then run the command below to install Django
pip install django
Once, you install Django in your virtual environment, you can create your Django project
django-admin startproject newproject
You should also, remember to deactivate your virtual env, once done by running the command below in the same virtual env
deactivate
Thank you!!