Project-level Environment Variables on a Project-Basis?

I find myself setting environment variables in several places routinely:

  1. Tools > Terminal
  2. Languages & Frameworks > Django
  3. Build, Execution, Deployment > Console > Python Console && Django Console
  4. Run/Debug Configurations (Django server, Celery, etc.)

I was hoping the Plugin EnvFile would apply to the entire project, but no, it doesn't.

It seems the only way to get environment variables in the consoles and terminal is to enter them in the table PyCharm control.

There is no way with EnvFile to define an .env file for these areas.

Maybe this is a feature request, but I'd like to be able to enter environment variables once and have those variables provided to all areas of the project - on a project basis.

0
2 comments

There's a feature request: https://youtrack.jetbrains.com/issue/PY-5543

And a workaround you could try: https://youtrack.jetbrains.com/issue/PY-5543#focus=Comments-27-712367.0-0

Also, if your env variables remain unchanged, you can set them in the terminal and then run PyCharm from this terminal session: 

For more information on how to start IDE from the terminal, please see:
(Change IDEA to PyCharm in the path)
 
0

An unfortunate inconvenience. Thanks for informing me of the feature request.

0

Please sign in to leave a comment.