Once your GitHub repository is set up and you're working on it locally, your first step is to create a virtual environment. This is essential for two key reasons; it prevents changes to your system's files or libraries, and ensures you can easily track all project-specific library requirements when it's time to deploy your website. This is done with the following command in the terminal:
python -m venv venv
This will create a venv folder in your project, which will be visible in the file explorer. Be sure to add this folder to your .gitignore file to avoid cluttering your repository with unnecessary files.
To activate your virtual environment, enter the following command in the terminal:
.\venv\Scripts\activate
A green (venv) will appear before your directory path, indicating the virtual environment is active. Keep in mind, this indicator may not show in new terminal windows, but the virtual environment remains active as long as it's visible in the main terminal. With the virtual environment active, any packages you download from your VSCode terminal will be installed only within the environment, keeping the rest of your PC clean and unaffected.
To deactivate your virtual environment, enter the following command in the terminal:
deactivate
Be sure to check that the virtual environment is active each work session you start.