Activate venv in current terminal

This commit is contained in:
emisargent 2023-02-18 01:13:41 +00:00
parent 4ae67d6aa9
commit b015c6b21e
2 changed files with 16 additions and 8 deletions

View file

@ -9,11 +9,18 @@
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"python.defaultInterpreterPath": "/workspaces/flask/.venv/bin/python",
// Settings for the python extension.
"python.defaultInterpreterPath": "${workspaceFolder}/.venv",
"python.terminal.activateEnvInCurrentTerminal": true,
"python.linting.enabled": true,
"python.linting.pylintEnabled": true
}
},
// Installs extensions on container create.
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance"
]
}
},

View file

@ -79,15 +79,16 @@ a `devcontainer`_ that installs required dependencies for you.
- Fork Flask to your GitHub account by clicking the `Fork`_ button.
- From your fork's repository page, click the green "Code" button and
then "Create codespace on main".
- Wait for the codespace to load and the "postCreateCommand" to
- Wait for the codespace to load and the ``postCreateCommand`` to
finish running.
- Open a new terminal or run ``. .venv/bin/activate`` to activate the
- Open a new terminal or run the following command to activate the
python virtualenv.
- Checkout a new branch and `start coding`_.
Note that when you reconnect to an existing codespace, you may need to
reactivate your python virtualenv by opening a new terminal or running
the ``. .venv/bin/activate`` command.
.. code-block:: text
$ . .venv/bin/activate
- Checkout a new branch and `start coding`_.
.. _GitHub Codespaces: https://docs.github.com/en/codespaces
.. _devcontainer: https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/introduction-to-dev-containers