Unable to run "django-admin" after closing vs code
I am working on a website project and someone suggested I do a Django tutorial. Using my VS Code, I ran through the steps to install using pip and then during the project I was instructed to setup a virtual environment. I had ended part of the project and when I went go back to the tutorial, nothing is working. I tried to run "django-admin" to review the available commands but I get error "django-admin : The term 'django-admin' is not recognized as the name of a cmdlet". I go to check the version of Python and Django and I get similar error's regarding "not recognized". I am able to run a python file but no command line commands. I'm wondering if something go messed up regarding the "PATH". I'm not an expert on any of these items, evidently just enough to make things break. Please advise,
It seems there's an issue related to the PATH env variable. You should add python and django to the system path variable to run python and django commands.
Adding system variables vary according to the OS you are using. Let me assume you are using Windows.
if the command python --version
doesn't work and have an error, it indicates python is not added to the system path.
Right click on This PC
in the explorer and select Properties
.
Click on "Advanced system settings" on the left or right(it might vary).
Click on the "Environment Variables" button.
In the "System variables" section, find the "Path" variable and select it, Click "Edit".
Click "New" and add the path to your Python installation.(e.g., C:\Python39\ and C:\Python39\Scripts).
Click ok to save the changes.
After doing this, you should activate your virtual environment and you could use python commands like pip install djanog or somehting.