Skip to content

Commit 6d721d8

Browse files
Add FAQ to README
1 parent 860969c commit 6d721d8

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

README.rst

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,52 @@ You can also use a Django-like choices tuple:
383383
>>> config('CONNECTION_TYPE', cast=Choices(choices=CONNECTION_OPTIONS))
384384
'bluetooth'
385385
386+
Frequently Asked Questions
387+
==========================
388+
389+
## 1. How to specify the `.env` path?
390+
391+
```python
392+
import os
393+
from decouple import Config, RepositoryEnv
394+
config = Config(RepositoryEnv("path/to/.env"))
395+
```
396+
397+
## 2. How to use python-decouple with Jupyter?
398+
399+
```python
400+
import os
401+
from decouple import Config, RepositoryEnv
402+
config = Config(RepositoryEnv("path/to/.env"))
403+
```
404+
405+
## 3. How to specify a file with another name instead of `.env`?
406+
407+
```python
408+
import os
409+
from decouple import Config, RepositoryEnv
410+
config = Config(RepositoryEnv("path/to/somefile-like-env"))
411+
```
412+
413+
## 4. How to define the path to my env file on a env var?
414+
415+
```python
416+
import os
417+
from decouple import Config, RepositoryEnv
418+
419+
DOTENV_FILE = os.environ.get("DOTENV_FILE", ".env") # only place using os.environ
420+
config = Config(RepositoryEnv(DOTENV_FILE))
421+
```
422+
423+
## 5. How can I have multiple *env* files working together?
424+
425+
```python
426+
from collections import ChainMap
427+
from decouple import Config, RepositoryEnv
428+
429+
config = Config(ChainMap(RepositoryEnv(".private.env"), RepositoryEnv(".env")))
430+
```
431+
386432
Contribute
387433
==========
388434

0 commit comments

Comments
 (0)