为 PyCharm 中的所有配置设置相同的环境变量
Set the same environment variables for all configurations in PyCharm
我有一个 Celery 项目和很多不同的工人。
如何避免每次将 PyCharm 中的环境变量复制粘贴到 Run/Debug 的每个配置中?
有没有办法在项目设置中设置它们?
找到解决方案, it is about installing plugin EnvFile并将所有环境变量放入文件。
The installation is pretty simple:
Preferences > Plugins > Browse repositories... > Search for "Env File" > Install Plugin.
Then, create a file, called environment.env which contains:
DATABASE_URL=postgres://127.0.0.1:5432/my_db_name
DEBUG=1 Then I went
to Run -> Edit Configurations, and I followed the steps in the next image:
P.S。在 link 的问题中,有 2 个答案有很多票(目前:44 和 42)。并接受了这里的作品,但其他有更多投票和大屏幕截图的作品 - 不要,因为它是一般如何设置环境变量。
我有一个 Celery 项目和很多不同的工人。
如何避免每次将 PyCharm 中的环境变量复制粘贴到 Run/Debug 的每个配置中?
有没有办法在项目设置中设置它们?
找到解决方案
The installation is pretty simple:
Preferences > Plugins > Browse repositories... > Search for "Env File" > Install Plugin.
Then, create a file, called environment.env which contains:
DATABASE_URL=postgres://127.0.0.1:5432/my_db_name DEBUG=1 Then I went
to Run -> Edit Configurations, and I followed the steps in the next image:
P.S。在 link 的问题中,有 2 个答案有很多票(目前:44 和 42)。并接受了这里的作品,但其他有更多投票和大屏幕截图的作品 - 不要,因为它是一般如何设置环境变量。