Use python-dotenv for environment variables.
PyCharm did not load conda environment variables.communication
parent
471aca4587
commit
9711c1b202
|
@ -0,0 +1 @@
|
||||||
|
/.env
|
26
README.md
26
README.md
|
@ -20,29 +20,9 @@ To install:
|
||||||
conda activate straw2analysis
|
conda activate straw2analysis
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Follow [the instructions](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#saving-environment-variables) to set DB_PASSWORD as the environment variable.
|
2. Provide an .env file to be used by `python-dotenv` which should be placed in the top folder of the application
|
||||||
|
and should have the form:
|
||||||
In short, use:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
cd $CONDA_PREFIX
|
|
||||||
mkdir -p ./etc/conda/activate.d
|
|
||||||
mkdir -p ./etc/conda/deactivate.d
|
|
||||||
touch ./etc/conda/activate.d/env_vars.sh
|
|
||||||
touch ./etc/conda/deactivate.d/env_vars.sh
|
|
||||||
```
|
|
||||||
and then edit `./etc/conda/activate.d/env_vars.sh` as follows:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
export DB_PASSWORD='database-password'
|
|
||||||
```
|
```
|
||||||
|
DB_PASSWORD=database-password
|
||||||
and `./etc/conda/deactivate.d/env_vars.sh` as follows:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
unset DB_PASSWORD
|
|
||||||
```
|
```
|
|
@ -10,4 +10,4 @@ dependencies:
|
||||||
- mypy
|
- mypy
|
||||||
- pre-commit
|
- pre-commit
|
||||||
- psycopg2
|
- psycopg2
|
||||||
- python-dotenv
|
- python-dotenv
|
Loading…
Reference in New Issue