How to debug Django while using pipenv and VS Code?

Viewed 811

I'm been using VS code and venv for my Django projects and have been able to debug using the tutorial provided by Microsoft here.

https://code.visualstudio.com/docs/python/tutorial-django

However, I have now switched to pipenv instead which I activate using the commmand pipenv shell.

When I now run using the Django debug configuration I get an error.

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?

I can't find any resources to guide me on this.

Do I need to change the launch.json file to make it work with pipenv?

1 Answers

you just need to choose an interpreter in my case, all pipenv interpreters are located in the ~/.virtualenvs folder here is the screenshot

Related