20👍
✅
For me, the following 2 changes worked
- Add an absolute path for pythonPath
- Use the
"--noreload"
option while starting the project
Here’s the relevant part of my config
{
"name": "Django",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "/Users/xyz/Documents/dev/my_project/my_project_env/bin/python",
"program": "${workspaceRoot}/manage.py",
"args": [
"runserver",
"0.0.0.0:8080",
"--noreload"
],
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput",
"DjangoDebugging"
]
},
6👍
1) Press CTRL + ,
2) Select Workspace Settings
3) Add the following line in the settings file opened.
"python.pythonPath": "path_to_your_env"
You’re done!
4👍
This official tutorial worked in my case.
Just needed to open the "command palette" of VS Code and select my Python Interpreter to the virtual environment:
Full reference: https://code.visualstudio.com/docs/python/tutorial-django#_create-a-project-environment-for-the-django-tutorial
- Why is django's settings object a LazyObject?
- Using bundle_files = 1 with py2exe is not working
- Django query with distinct and order_by
- Django admin many-to-many intermediary models using through= and filter_horizontal
- How to login a user during a unit test in Django REST Framework?
Source:stackexchange.com