I want to share PyCharm run/debug configurations with my team. I need a way of configure run/debug configurations so they can work also in other computers.
Is there a dynamic way of getting the project's dir? Any ideas?
Perhaps a way to change say "C:\PythonPlatform\Test\" to something like "${PROJECT_DIR}\Test" in the "Folders" and "Working directory" fields? See the image:
However, if you do not want to share the . idea directory, you can save the configuration to any other directory within the project. By default, it is disabled, and PyCharm stores run configuration settings in . idea/workspace.
From the main menu, select File | Manage IDE Settings | Restore Default Settings. Alternatively, press Shift twice and type Restore default settings . Click Restore and Restart. The IDE will be restarted with the default configuration.
There are so called Macros in PyCharm which include $ProjectFileDir$
described as The directory of the project file. However it seems they can only be used in External Tools section and not in Run/Debug Configurations. However, there's very relevant issue titled Add support for macros in Run/Debug Configurations screen raised in another JetBrains' product — WebStorm. There, we find information that the path to any file underneath project's directory is stored relatively to the project's directory meaning that if the project is placed somewhere else in the filesystem the file would still be found. In other words paths you see are presented as absolute paths but they are in fact relative to the project's directory. I must admit it's confusing to say the least.
I created issue Add support for macros in run/debug configurations — feel free to vote on it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With