Open a terminal and go to wherever you want to create your project!
Make sure to replace $PROJECT_NAME with your own project name. Your project name should be named in snake_case and contain no captial letters.
-
Create a directory
mkdir $PROJECT_NAME
-
Change into that directory
cd $PROJECT_NAME
-
Create a virtual environment
python -m venv env
- On older versions of Windows:
py.exe -m venv env
-
Activate The Environment
- On (Mac/Linux):
source env/bin/activate
- On Windows:
env/Scripts/activate
- On (Mac/Linux):
-
Install django
pip install django
-
Create your project in the currect directory
django-admin startproject $PROJECT_NAME .
- The period at the end of this command is important! It says ignore creating a new folder and put the contents of our new project in the current directory.
Once you've finished up your work on the project make sure to call the deactivate
command to exit your virtual environment.