[Python] PyCharm Flask configuration uses the wrong folder as working directory?

Discussão em 'Python' iniciado por Stack, Janeiro 29, 2025.

  1. Stack

    Stack Membro Participativo

    For no apparent reason, Flask decided to use a folder one level above the actual project directory.

    Project details:

    • Working directory in Run/Debug is set correctly
    • Python console in PyCharm starts in the correct directory
    • The parent folder is mentioned once -- in the "Paths to .env files" field, where a single .env file is included
    • Settings -> Project: projectname -> Project Structure shows the correct structure (intended working directory is set as project root)
    • Just in case, I set the working directory for both Python and Flask consoles in Settings -> Build, Execution, Deployment -> Console to project root

    Despite the working directory being set in every place I could think of, when I try to use the project, I get an error because it tried to load a file from the parent directory (e. g. ~/file.yml instead of ~/projectname/file.yml).

    Running the project manually via the default Python configuration with the same working directory and env file path settings works fine.

    What am I missing?

    Continue reading...

Compartilhe esta Página