I have a project with Celery and a lot of different workers.
How to avoid copy-pasting environment variables in PyCharm each time to each configuration for Run/Debug?
Is there any way to set them in projects settings?
Asked
Active
Viewed 2,135 times
3

wowkin2
- 5,895
- 5
- 23
- 66
-
1This question might be answered by looking at this: https://stackoverflow.com/questions/42708389/how-to-set-environment-variables-in-pycharm – crowgers Dec 14 '18 at 10:35
-
Thanks, haven't mentioned the Accepted answer, because there is another with more votes and large screenshots, that hides the actually useful thing. – wowkin2 Dec 14 '18 at 10:49
1 Answers
1
Found solution here, it is about installing plugin EnvFile and put all environment variables to a file.
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. in the question by link there are 2 answers with many votes (for now: 44 and 42). And accepted works here, but other with more votes and large screenshots - don't, because it is how to set environment variables in general.

wowkin2
- 5,895
- 5
- 23
- 66