Search code examples
pythonvisual-studio-codepython-poetryvirtual-environmentcodespaces

Configuring Python Environment (poetry) in Codespaces


I want to select my project's python interpreter as poetry environment in Codespaces. By the way I connect codespaces with my local VSCode. I can see and select interpreter from poetry via command palette.

However it doesn't seem to work, since the imports are undefined for VSCode.

I can use poetry environment with VSCode, when I work local and start VSCode in poetry shell with the command code . but I can't use this, since it is a remote development environment.

In the screenshot you can clearly see, that I selected poetry as Python Interpreter.


Solution

  • First, make sure you have django installed in your current environment. Detailed tutorials can be found here.

    Then, your error is provided by Linting, if your code can run normally. Linting can be turned off in the following ways.

    1. Ctrl+Shift+P

    2. search and select Python:Enable/Disable Lingting

      enter image description here

    3. Choose Disable

      enter image description here