Visual Studio Code Is Not Able To Launch Django Project From Debugger
I am using Visual Studio Code as my IDE for building web applications using Python's Django web development framework. I am developing on a 2018 MacBook Pro. I am able to launch my web applications by launching them in the terminal using:
python3 manage.py runserver
However, I want to be able to launch my application through the debugger. To try and do this, I navigated to the debug section, created the launch.json file, and changed my configuration in the drop down to Python: Django. Here is are my configurations from the file.
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"console": "integratedTerminal",
"args": [
"runserver",
"--noreload",
"--nothreading"
],
"django": true
},
When I try to run the debugger using the green play arrow, I get the following exception:
Exception has occurred: 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? File
"/Users/justinoconnor/Desktop/Rapid
Prototyping/Projects/hello_django/manage.py", line 14, in
) from exc
Launching the VS Code debugger with this configuration should be the same as running python manage.py runserver --noreload --nothreading, but it is not working. I'm thinking it is because on the MacBook I have to use the "python3" command rather than "python", but I did not see anything in the documentation that would allow me to specify this in the launch.json configuration file.
Does anyone know how to resolve this so that when I run the debugger it automatically executes/saves my project? I don't understand why this is not working when I can type python3 manage.py runserver into the terminal and it will execute just fine.
python django importerror
|
show 3 more comments
I am using Visual Studio Code as my IDE for building web applications using Python's Django web development framework. I am developing on a 2018 MacBook Pro. I am able to launch my web applications by launching them in the terminal using:
python3 manage.py runserver
However, I want to be able to launch my application through the debugger. To try and do this, I navigated to the debug section, created the launch.json file, and changed my configuration in the drop down to Python: Django. Here is are my configurations from the file.
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"console": "integratedTerminal",
"args": [
"runserver",
"--noreload",
"--nothreading"
],
"django": true
},
When I try to run the debugger using the green play arrow, I get the following exception:
Exception has occurred: 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? File
"/Users/justinoconnor/Desktop/Rapid
Prototyping/Projects/hello_django/manage.py", line 14, in
) from exc
Launching the VS Code debugger with this configuration should be the same as running python manage.py runserver --noreload --nothreading, but it is not working. I'm thinking it is because on the MacBook I have to use the "python3" command rather than "python", but I did not see anything in the documentation that would allow me to specify this in the launch.json configuration file.
Does anyone know how to resolve this so that when I run the debugger it automatically executes/saves my project? I don't understand why this is not working when I can type python3 manage.py runserver into the terminal and it will execute just fine.
python django importerror
In VS Code try to do Cmd + Shift + P and write "select interpreter", you should see an option called "Python: Select Interpreter", choose it and wait until you get a list of interpreters. Select a python3 interpreter and see if that does the trick. (ideally select the python3 interpreter from your virtual environment)
– Boregore
Nov 22 '18 at 1:27
Also when you run the debugger you can see the actual command, in the VS Code terminal, that is executed to launch your project, so you can see which python executable is used.
– Boregore
Nov 22 '18 at 1:45
That is what I have done so far. I started the terminal with "Terminal: Create New Integrated Terminal" and selected the interpreter for my virtual environment using "Python: Select Interpreter" and selecting "Python 3.7.1 64-Bit ('env':venv) at "./env/bin/python". This works when I am editing the code and type "python3 manage.py runserver" in the terminal, but not when I run the debugger. Thanks!
– Justin
Nov 22 '18 at 1:50
Boregore, this is what I get in the terminal. (env) US6749343-M001:hello_django justinoconnor$ cd "/Users/justinoconnor/Desktop/Rapid Prototyping/Projects/hello_django" ; env "PYTHONIOENCODING=UTF-8" "PYTHONUNBUFFERED=1" "/Users/justinoconnor/Desktop/Rapid Prototyping/Projects/hello_django/env/bin/python" /Users/justinoconnor/.vscode/extensions/ms-python.python-2018.10.1/pythonFiles/experimental/ptvsd_launcher.py --client --host localhost --port 51054 "/Users/justinoconnor/Desktop/Rapid Prototyping/Projects/hello_django/manage.py" runserver --noreload --nothreading
– Justin
Nov 22 '18 at 1:51
Ok, so it looks like it's using the correct python executable. I'm kinda in the dark here, but try the following: In the terminal (with the virtual environment activated) run "python --version" (to verify the installed version in the virtual environment) and "pip freeze" (to list installed modules int the virtual environment and verify django install).
– Boregore
Nov 22 '18 at 2:27
|
show 3 more comments
I am using Visual Studio Code as my IDE for building web applications using Python's Django web development framework. I am developing on a 2018 MacBook Pro. I am able to launch my web applications by launching them in the terminal using:
python3 manage.py runserver
However, I want to be able to launch my application through the debugger. To try and do this, I navigated to the debug section, created the launch.json file, and changed my configuration in the drop down to Python: Django. Here is are my configurations from the file.
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"console": "integratedTerminal",
"args": [
"runserver",
"--noreload",
"--nothreading"
],
"django": true
},
When I try to run the debugger using the green play arrow, I get the following exception:
Exception has occurred: 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? File
"/Users/justinoconnor/Desktop/Rapid
Prototyping/Projects/hello_django/manage.py", line 14, in
) from exc
Launching the VS Code debugger with this configuration should be the same as running python manage.py runserver --noreload --nothreading, but it is not working. I'm thinking it is because on the MacBook I have to use the "python3" command rather than "python", but I did not see anything in the documentation that would allow me to specify this in the launch.json configuration file.
Does anyone know how to resolve this so that when I run the debugger it automatically executes/saves my project? I don't understand why this is not working when I can type python3 manage.py runserver into the terminal and it will execute just fine.
python django importerror
I am using Visual Studio Code as my IDE for building web applications using Python's Django web development framework. I am developing on a 2018 MacBook Pro. I am able to launch my web applications by launching them in the terminal using:
python3 manage.py runserver
However, I want to be able to launch my application through the debugger. To try and do this, I navigated to the debug section, created the launch.json file, and changed my configuration in the drop down to Python: Django. Here is are my configurations from the file.
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"console": "integratedTerminal",
"args": [
"runserver",
"--noreload",
"--nothreading"
],
"django": true
},
When I try to run the debugger using the green play arrow, I get the following exception:
Exception has occurred: 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? File
"/Users/justinoconnor/Desktop/Rapid
Prototyping/Projects/hello_django/manage.py", line 14, in
) from exc
Launching the VS Code debugger with this configuration should be the same as running python manage.py runserver --noreload --nothreading, but it is not working. I'm thinking it is because on the MacBook I have to use the "python3" command rather than "python", but I did not see anything in the documentation that would allow me to specify this in the launch.json configuration file.
Does anyone know how to resolve this so that when I run the debugger it automatically executes/saves my project? I don't understand why this is not working when I can type python3 manage.py runserver into the terminal and it will execute just fine.
python django importerror
python django importerror
asked Nov 21 '18 at 23:42
JustinJustin
1167
1167
In VS Code try to do Cmd + Shift + P and write "select interpreter", you should see an option called "Python: Select Interpreter", choose it and wait until you get a list of interpreters. Select a python3 interpreter and see if that does the trick. (ideally select the python3 interpreter from your virtual environment)
– Boregore
Nov 22 '18 at 1:27
Also when you run the debugger you can see the actual command, in the VS Code terminal, that is executed to launch your project, so you can see which python executable is used.
– Boregore
Nov 22 '18 at 1:45
That is what I have done so far. I started the terminal with "Terminal: Create New Integrated Terminal" and selected the interpreter for my virtual environment using "Python: Select Interpreter" and selecting "Python 3.7.1 64-Bit ('env':venv) at "./env/bin/python". This works when I am editing the code and type "python3 manage.py runserver" in the terminal, but not when I run the debugger. Thanks!
– Justin
Nov 22 '18 at 1:50
Boregore, this is what I get in the terminal. (env) US6749343-M001:hello_django justinoconnor$ cd "/Users/justinoconnor/Desktop/Rapid Prototyping/Projects/hello_django" ; env "PYTHONIOENCODING=UTF-8" "PYTHONUNBUFFERED=1" "/Users/justinoconnor/Desktop/Rapid Prototyping/Projects/hello_django/env/bin/python" /Users/justinoconnor/.vscode/extensions/ms-python.python-2018.10.1/pythonFiles/experimental/ptvsd_launcher.py --client --host localhost --port 51054 "/Users/justinoconnor/Desktop/Rapid Prototyping/Projects/hello_django/manage.py" runserver --noreload --nothreading
– Justin
Nov 22 '18 at 1:51
Ok, so it looks like it's using the correct python executable. I'm kinda in the dark here, but try the following: In the terminal (with the virtual environment activated) run "python --version" (to verify the installed version in the virtual environment) and "pip freeze" (to list installed modules int the virtual environment and verify django install).
– Boregore
Nov 22 '18 at 2:27
|
show 3 more comments
In VS Code try to do Cmd + Shift + P and write "select interpreter", you should see an option called "Python: Select Interpreter", choose it and wait until you get a list of interpreters. Select a python3 interpreter and see if that does the trick. (ideally select the python3 interpreter from your virtual environment)
– Boregore
Nov 22 '18 at 1:27
Also when you run the debugger you can see the actual command, in the VS Code terminal, that is executed to launch your project, so you can see which python executable is used.
– Boregore
Nov 22 '18 at 1:45
That is what I have done so far. I started the terminal with "Terminal: Create New Integrated Terminal" and selected the interpreter for my virtual environment using "Python: Select Interpreter" and selecting "Python 3.7.1 64-Bit ('env':venv) at "./env/bin/python". This works when I am editing the code and type "python3 manage.py runserver" in the terminal, but not when I run the debugger. Thanks!
– Justin
Nov 22 '18 at 1:50
Boregore, this is what I get in the terminal. (env) US6749343-M001:hello_django justinoconnor$ cd "/Users/justinoconnor/Desktop/Rapid Prototyping/Projects/hello_django" ; env "PYTHONIOENCODING=UTF-8" "PYTHONUNBUFFERED=1" "/Users/justinoconnor/Desktop/Rapid Prototyping/Projects/hello_django/env/bin/python" /Users/justinoconnor/.vscode/extensions/ms-python.python-2018.10.1/pythonFiles/experimental/ptvsd_launcher.py --client --host localhost --port 51054 "/Users/justinoconnor/Desktop/Rapid Prototyping/Projects/hello_django/manage.py" runserver --noreload --nothreading
– Justin
Nov 22 '18 at 1:51
Ok, so it looks like it's using the correct python executable. I'm kinda in the dark here, but try the following: In the terminal (with the virtual environment activated) run "python --version" (to verify the installed version in the virtual environment) and "pip freeze" (to list installed modules int the virtual environment and verify django install).
– Boregore
Nov 22 '18 at 2:27
In VS Code try to do Cmd + Shift + P and write "select interpreter", you should see an option called "Python: Select Interpreter", choose it and wait until you get a list of interpreters. Select a python3 interpreter and see if that does the trick. (ideally select the python3 interpreter from your virtual environment)
– Boregore
Nov 22 '18 at 1:27
In VS Code try to do Cmd + Shift + P and write "select interpreter", you should see an option called "Python: Select Interpreter", choose it and wait until you get a list of interpreters. Select a python3 interpreter and see if that does the trick. (ideally select the python3 interpreter from your virtual environment)
– Boregore
Nov 22 '18 at 1:27
Also when you run the debugger you can see the actual command, in the VS Code terminal, that is executed to launch your project, so you can see which python executable is used.
– Boregore
Nov 22 '18 at 1:45
Also when you run the debugger you can see the actual command, in the VS Code terminal, that is executed to launch your project, so you can see which python executable is used.
– Boregore
Nov 22 '18 at 1:45
That is what I have done so far. I started the terminal with "Terminal: Create New Integrated Terminal" and selected the interpreter for my virtual environment using "Python: Select Interpreter" and selecting "Python 3.7.1 64-Bit ('env':venv) at "./env/bin/python". This works when I am editing the code and type "python3 manage.py runserver" in the terminal, but not when I run the debugger. Thanks!
– Justin
Nov 22 '18 at 1:50
That is what I have done so far. I started the terminal with "Terminal: Create New Integrated Terminal" and selected the interpreter for my virtual environment using "Python: Select Interpreter" and selecting "Python 3.7.1 64-Bit ('env':venv) at "./env/bin/python". This works when I am editing the code and type "python3 manage.py runserver" in the terminal, but not when I run the debugger. Thanks!
– Justin
Nov 22 '18 at 1:50
Boregore, this is what I get in the terminal. (env) US6749343-M001:hello_django justinoconnor$ cd "/Users/justinoconnor/Desktop/Rapid Prototyping/Projects/hello_django" ; env "PYTHONIOENCODING=UTF-8" "PYTHONUNBUFFERED=1" "/Users/justinoconnor/Desktop/Rapid Prototyping/Projects/hello_django/env/bin/python" /Users/justinoconnor/.vscode/extensions/ms-python.python-2018.10.1/pythonFiles/experimental/ptvsd_launcher.py --client --host localhost --port 51054 "/Users/justinoconnor/Desktop/Rapid Prototyping/Projects/hello_django/manage.py" runserver --noreload --nothreading
– Justin
Nov 22 '18 at 1:51
Boregore, this is what I get in the terminal. (env) US6749343-M001:hello_django justinoconnor$ cd "/Users/justinoconnor/Desktop/Rapid Prototyping/Projects/hello_django" ; env "PYTHONIOENCODING=UTF-8" "PYTHONUNBUFFERED=1" "/Users/justinoconnor/Desktop/Rapid Prototyping/Projects/hello_django/env/bin/python" /Users/justinoconnor/.vscode/extensions/ms-python.python-2018.10.1/pythonFiles/experimental/ptvsd_launcher.py --client --host localhost --port 51054 "/Users/justinoconnor/Desktop/Rapid Prototyping/Projects/hello_django/manage.py" runserver --noreload --nothreading
– Justin
Nov 22 '18 at 1:51
Ok, so it looks like it's using the correct python executable. I'm kinda in the dark here, but try the following: In the terminal (with the virtual environment activated) run "python --version" (to verify the installed version in the virtual environment) and "pip freeze" (to list installed modules int the virtual environment and verify django install).
– Boregore
Nov 22 '18 at 2:27
Ok, so it looks like it's using the correct python executable. I'm kinda in the dark here, but try the following: In the terminal (with the virtual environment activated) run "python --version" (to verify the installed version in the virtual environment) and "pip freeze" (to list installed modules int the virtual environment and verify django install).
– Boregore
Nov 22 '18 at 2:27
|
show 3 more comments
2 Answers
2
active
oldest
votes
Use the command virtualenv -p python3 venv
(or replace "venv" with your virtual environment name) in the terminal to create the virtual environment with python3 as the default when "python" is used in the terminal (e.g. python manage.py ...
).
The -p
is used to specify a specific version of python.
add a comment |
The issue was that I used the "python" command instead of the "python3" command when creating the virtual environment for my project. This was causing the debugger to execute the wrong command when trying run the local server. I was able to create a new virtual environment using the command ...
python3 -m venv env
... that the Visual Studio Code debugger was able to successfully recognize when debugging using the "Python: Django" drop down configuration.
I posted the solution as an answer too - will you be so kind and accept it? :-)
– Boregore
Nov 22 '18 at 4:02
I'm relatively new to stack overflow. Your solution is showing for me. Is there something I need to do to "accept" your answer so it shows for everyone else?
– Justin
Nov 26 '18 at 0:37
You just need to click the checkmark-button on the left side of my answer. This will show my answer as the "accepted answer". It also gives me a couple of reputation points (like when I just up voted your question), which is what stackoverflow users are striving for. It makes your answers look more credible and also you get more access to more features the higher your reputation is. It's a nice way of showing appreciation for the help you have received :-) Also when you upvote an answer it will get shown before less upvoted answers.
– Boregore
Nov 27 '18 at 18:07
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53421991%2fvisual-studio-code-is-not-able-to-launch-django-project-from-debugger%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Use the command virtualenv -p python3 venv
(or replace "venv" with your virtual environment name) in the terminal to create the virtual environment with python3 as the default when "python" is used in the terminal (e.g. python manage.py ...
).
The -p
is used to specify a specific version of python.
add a comment |
Use the command virtualenv -p python3 venv
(or replace "venv" with your virtual environment name) in the terminal to create the virtual environment with python3 as the default when "python" is used in the terminal (e.g. python manage.py ...
).
The -p
is used to specify a specific version of python.
add a comment |
Use the command virtualenv -p python3 venv
(or replace "venv" with your virtual environment name) in the terminal to create the virtual environment with python3 as the default when "python" is used in the terminal (e.g. python manage.py ...
).
The -p
is used to specify a specific version of python.
Use the command virtualenv -p python3 venv
(or replace "venv" with your virtual environment name) in the terminal to create the virtual environment with python3 as the default when "python" is used in the terminal (e.g. python manage.py ...
).
The -p
is used to specify a specific version of python.
answered Nov 22 '18 at 4:01
BoregoreBoregore
6910
6910
add a comment |
add a comment |
The issue was that I used the "python" command instead of the "python3" command when creating the virtual environment for my project. This was causing the debugger to execute the wrong command when trying run the local server. I was able to create a new virtual environment using the command ...
python3 -m venv env
... that the Visual Studio Code debugger was able to successfully recognize when debugging using the "Python: Django" drop down configuration.
I posted the solution as an answer too - will you be so kind and accept it? :-)
– Boregore
Nov 22 '18 at 4:02
I'm relatively new to stack overflow. Your solution is showing for me. Is there something I need to do to "accept" your answer so it shows for everyone else?
– Justin
Nov 26 '18 at 0:37
You just need to click the checkmark-button on the left side of my answer. This will show my answer as the "accepted answer". It also gives me a couple of reputation points (like when I just up voted your question), which is what stackoverflow users are striving for. It makes your answers look more credible and also you get more access to more features the higher your reputation is. It's a nice way of showing appreciation for the help you have received :-) Also when you upvote an answer it will get shown before less upvoted answers.
– Boregore
Nov 27 '18 at 18:07
add a comment |
The issue was that I used the "python" command instead of the "python3" command when creating the virtual environment for my project. This was causing the debugger to execute the wrong command when trying run the local server. I was able to create a new virtual environment using the command ...
python3 -m venv env
... that the Visual Studio Code debugger was able to successfully recognize when debugging using the "Python: Django" drop down configuration.
I posted the solution as an answer too - will you be so kind and accept it? :-)
– Boregore
Nov 22 '18 at 4:02
I'm relatively new to stack overflow. Your solution is showing for me. Is there something I need to do to "accept" your answer so it shows for everyone else?
– Justin
Nov 26 '18 at 0:37
You just need to click the checkmark-button on the left side of my answer. This will show my answer as the "accepted answer". It also gives me a couple of reputation points (like when I just up voted your question), which is what stackoverflow users are striving for. It makes your answers look more credible and also you get more access to more features the higher your reputation is. It's a nice way of showing appreciation for the help you have received :-) Also when you upvote an answer it will get shown before less upvoted answers.
– Boregore
Nov 27 '18 at 18:07
add a comment |
The issue was that I used the "python" command instead of the "python3" command when creating the virtual environment for my project. This was causing the debugger to execute the wrong command when trying run the local server. I was able to create a new virtual environment using the command ...
python3 -m venv env
... that the Visual Studio Code debugger was able to successfully recognize when debugging using the "Python: Django" drop down configuration.
The issue was that I used the "python" command instead of the "python3" command when creating the virtual environment for my project. This was causing the debugger to execute the wrong command when trying run the local server. I was able to create a new virtual environment using the command ...
python3 -m venv env
... that the Visual Studio Code debugger was able to successfully recognize when debugging using the "Python: Django" drop down configuration.
edited Nov 26 '18 at 0:36
answered Nov 22 '18 at 3:18
JustinJustin
1167
1167
I posted the solution as an answer too - will you be so kind and accept it? :-)
– Boregore
Nov 22 '18 at 4:02
I'm relatively new to stack overflow. Your solution is showing for me. Is there something I need to do to "accept" your answer so it shows for everyone else?
– Justin
Nov 26 '18 at 0:37
You just need to click the checkmark-button on the left side of my answer. This will show my answer as the "accepted answer". It also gives me a couple of reputation points (like when I just up voted your question), which is what stackoverflow users are striving for. It makes your answers look more credible and also you get more access to more features the higher your reputation is. It's a nice way of showing appreciation for the help you have received :-) Also when you upvote an answer it will get shown before less upvoted answers.
– Boregore
Nov 27 '18 at 18:07
add a comment |
I posted the solution as an answer too - will you be so kind and accept it? :-)
– Boregore
Nov 22 '18 at 4:02
I'm relatively new to stack overflow. Your solution is showing for me. Is there something I need to do to "accept" your answer so it shows for everyone else?
– Justin
Nov 26 '18 at 0:37
You just need to click the checkmark-button on the left side of my answer. This will show my answer as the "accepted answer". It also gives me a couple of reputation points (like when I just up voted your question), which is what stackoverflow users are striving for. It makes your answers look more credible and also you get more access to more features the higher your reputation is. It's a nice way of showing appreciation for the help you have received :-) Also when you upvote an answer it will get shown before less upvoted answers.
– Boregore
Nov 27 '18 at 18:07
I posted the solution as an answer too - will you be so kind and accept it? :-)
– Boregore
Nov 22 '18 at 4:02
I posted the solution as an answer too - will you be so kind and accept it? :-)
– Boregore
Nov 22 '18 at 4:02
I'm relatively new to stack overflow. Your solution is showing for me. Is there something I need to do to "accept" your answer so it shows for everyone else?
– Justin
Nov 26 '18 at 0:37
I'm relatively new to stack overflow. Your solution is showing for me. Is there something I need to do to "accept" your answer so it shows for everyone else?
– Justin
Nov 26 '18 at 0:37
You just need to click the checkmark-button on the left side of my answer. This will show my answer as the "accepted answer". It also gives me a couple of reputation points (like when I just up voted your question), which is what stackoverflow users are striving for. It makes your answers look more credible and also you get more access to more features the higher your reputation is. It's a nice way of showing appreciation for the help you have received :-) Also when you upvote an answer it will get shown before less upvoted answers.
– Boregore
Nov 27 '18 at 18:07
You just need to click the checkmark-button on the left side of my answer. This will show my answer as the "accepted answer". It also gives me a couple of reputation points (like when I just up voted your question), which is what stackoverflow users are striving for. It makes your answers look more credible and also you get more access to more features the higher your reputation is. It's a nice way of showing appreciation for the help you have received :-) Also when you upvote an answer it will get shown before less upvoted answers.
– Boregore
Nov 27 '18 at 18:07
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53421991%2fvisual-studio-code-is-not-able-to-launch-django-project-from-debugger%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
In VS Code try to do Cmd + Shift + P and write "select interpreter", you should see an option called "Python: Select Interpreter", choose it and wait until you get a list of interpreters. Select a python3 interpreter and see if that does the trick. (ideally select the python3 interpreter from your virtual environment)
– Boregore
Nov 22 '18 at 1:27
Also when you run the debugger you can see the actual command, in the VS Code terminal, that is executed to launch your project, so you can see which python executable is used.
– Boregore
Nov 22 '18 at 1:45
That is what I have done so far. I started the terminal with "Terminal: Create New Integrated Terminal" and selected the interpreter for my virtual environment using "Python: Select Interpreter" and selecting "Python 3.7.1 64-Bit ('env':venv) at "./env/bin/python". This works when I am editing the code and type "python3 manage.py runserver" in the terminal, but not when I run the debugger. Thanks!
– Justin
Nov 22 '18 at 1:50
Boregore, this is what I get in the terminal. (env) US6749343-M001:hello_django justinoconnor$ cd "/Users/justinoconnor/Desktop/Rapid Prototyping/Projects/hello_django" ; env "PYTHONIOENCODING=UTF-8" "PYTHONUNBUFFERED=1" "/Users/justinoconnor/Desktop/Rapid Prototyping/Projects/hello_django/env/bin/python" /Users/justinoconnor/.vscode/extensions/ms-python.python-2018.10.1/pythonFiles/experimental/ptvsd_launcher.py --client --host localhost --port 51054 "/Users/justinoconnor/Desktop/Rapid Prototyping/Projects/hello_django/manage.py" runserver --noreload --nothreading
– Justin
Nov 22 '18 at 1:51
Ok, so it looks like it's using the correct python executable. I'm kinda in the dark here, but try the following: In the terminal (with the virtual environment activated) run "python --version" (to verify the installed version in the virtual environment) and "pip freeze" (to list installed modules int the virtual environment and verify django install).
– Boregore
Nov 22 '18 at 2:27