I am trying to figure out how to get the terminal in VScode to activate the virtual environment automatically. Thus far I have followed along without issues in Part I of the Django course but now I seem to have hit a wall.
First I tried following Mosh’s steps by locating the virtual environment location in terminal on the Mac using pipenv --venv
and this returned the location as /Users/lewpiper/.local/share/virtualenvs/storefront-7UYLLetM
on my Mac. I then tried to to use this in the command palette to select the python interpreter and it didn’t seem to work. I saw I had no VScode JSON file like the videos showed.
Then I tried to edit the workspace settings in VScode and add the following "python.pythonPath": "/Users/lewpiper/.local/share/virtualenvs/storefront-7UYLLetM"
to match Mosh’s file structure and again I am running into issues.
Now when I click play in VScode I get the following message “ImportError: Couldn’t import Django. Are you sure it’s installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?”
It seems like a few other people have struggled with this as well, but I haven’t been able to come to a solution. Any help or direction to guide me in the right direction would be very much appreciated.