99python-dotenv | [ ![ Build Status] ( https://travis-ci.org/theskumar/python-dotenv.svg?branch=master )] ( https://travis-ci.org/theskumar/python-dotenv ) [ ![ Coverage Status] ( https://coveralls.io/repos/theskumar/python-dotenv/badge.svg?branch=master )] ( https://coveralls.io/r/theskumar/python-dotenv?branch=master ) [ ![ PyPI version] ( https://badge.fury.io/py/python-dotenv.svg )] ( http://badge.fury.io/py/python-dotenv ) [ ![ Say Thanks!] ( https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg )] ( https://saythanks.io/to/theskumar )
1010===============================================================================
1111
12- Reads the key, value pair from ` .env ` file and adds them to environment
12+ Reads the key- value pair from ` .env ` file and adds them to environment
1313variable. It is great for managing app settings during development and
1414in production using [ 12-factor] ( http://12factor.net/ ) principles.
1515
@@ -18,7 +18,7 @@ in production using [12-factor](http://12factor.net/) principles.
1818- [ Usages] ( #usages )
1919- [ Installation] ( #installation )
2020- [ Command-line interface] ( #command-line-interface )
21- - [ iPython Support] ( #ipython-support )
21+ - [ IPython Support] ( #ipython-support )
2222- [ Setting config on remote servers] ( #setting-config-on-remote-servers )
2323- [ Related Projects] ( #related-projects )
2424- [ Contributing] ( #contributing )
@@ -38,7 +38,7 @@ environment-related method you need as provided by `os.getenv`.
3838` .env ` looks like this:
3939
4040``` shell
41- # a comment and that will be ignored.
41+ # a comment that will be ignored.
4242REDIS_ADDRESS=localhost:6379
4343MEANING_OF_LIFE=42
4444MULTILINE_VAR=" hello\nworld"
@@ -54,7 +54,7 @@ export SECRET_KEY=YOURSECRETKEYGOESHERE
5454` .env ` can interpolate variables using POSIX variable expansion,
5555variables are replaced from the environment first or from other values
5656in the ` .env ` file if the variable is not present in the environment.
57- (` Note ` : Default Value Expansion is not supported as of yet, see
57+ (** Note** : Default Value Expansion is not supported as of yet, see
5858[ \# 30] ( https://github.com/theskumar/python-dotenv/pull/30#issuecomment-244036604 ) .)
5959
6060``` shell
@@ -73,14 +73,14 @@ module.
7373 ├── .env
7474 └── settings.py
7575
76- Add the following code to your ` settings.py `
76+ Add the following code to your ` settings.py ` :
7777
7878``` python
7979# settings.py
8080from dotenv import load_dotenv
8181load_dotenv()
8282
83- # OR, the same with increased verbosity:
83+ # OR, the same with increased verbosity
8484load_dotenv(verbose = True )
8585
8686# OR, explicitly providing path to '.env'
@@ -89,9 +89,9 @@ env_path = Path('.') / '.env'
8989load_dotenv(dotenv_path = env_path)
9090```
9191
92- At this point, parsed key/value from the .env file is now present as
92+ At this point, parsed key/value from the ` .env ` file is now present as
9393system environment variable and they can be conveniently accessed via
94- ` os.getenv() `
94+ ` os.getenv() ` :
9595
9696``` python
9797# settings.py
@@ -134,27 +134,27 @@ before passing.
134134' EGGS'
135135```
136136
137- The returned value is dictionary with key value pair.
137+ The returned value is dictionary with key- value pair.
138138
139139` dotenv_values ` could be useful if you need to * consume* the envfile but
140140not * apply* it directly into the system environment.
141141
142142Django
143143------
144144
145- If you are using django you should add the above loader script at the
145+ If you are using Django, you should add the above loader script at the
146146top of ` wsgi.py ` and ` manage.py ` .
147147
148148Installation
149149============
150-
151- pip install -U python-dotenv
152-
153- iPython Support
150+ ``` shell
151+ pip install -U python-dotenv
152+ ```
153+ IPython Support
154154---------------
155155
156- You can use dotenv with iPython . You can either let the dotenv search
157- for .env with %dotenv or provide the path to .env file explicitly, see
156+ You can use dotenv with IPython . You can either let the dotenv search
157+ for ` .env ` with ` %dotenv ` or provide the path to the ` .env ` file explicitly; see
158158below for usages.
159159
160160 %load_ext dotenv
@@ -171,17 +171,19 @@ below for usages.
171171 # Use '-v' to turn verbose mode on
172172 %dotenv -v
173173
174- Command-line interface
174+ Command-line Interface
175175======================
176176
177- For commandline support, use the cli option during installation:
177+ For command-line support, use the CLI option during installation:
178178
179- pip install -U "python-dotenv[cli]"
179+ ``` shell
180+ pip install -U " python-dotenv[cli]"
181+ ```
180182
181- A cli interface ` dotenv ` is also included, which helps you manipulate
182- the ` .env ` file without manually opening it. The same cli installed on
183+ A CLI interface ` dotenv ` is also included, which helps you manipulate
184+ the ` .env ` file without manually opening it. The same CLI installed on
183185remote machine combined with fabric (discussed later) will enable you to
184- update your settings on remote server, handy isn't it!
186+ update your settings on a remote server; handy, isn't it!
185187
186188```
187189Usage: dotenv [OPTIONS] COMMAND [ARGS]...
@@ -205,11 +207,11 @@ Commands:
205207 unset Removes the given key.
206208```
207209
208- Setting config on remote servers
210+ Setting config on Remote Servers
209211--------------------------------
210212
211- We make use of excellent [ Fabric] ( http://www.fabfile.org/ ) to acomplish
212- this. Add a config task to your local fabfile, ` dotenv_path ` is the
213+ We make use of excellent [ Fabric] ( http://www.fabfile.org/ ) to accomplish
214+ this. Add a config task to your local fabfile; ` dotenv_path ` is the
213215location of the absolute path of ` .env ` file on the remote server.
214216
215217``` python
@@ -235,27 +237,27 @@ def config(action=None, key=None, value=None):
235237 run(command)
236238```
237239
238- Usage is designed to mirror the heroku config api very closely.
240+ Usage is designed to mirror the Heroku config API very closely.
239241
240- Get all your remote config info with ` fab config `
242+ Get all your remote config info with ` fab config ` :
241243
242244 $ fab config
243245 foo="bar"
244246
245- Set remote config variables with ` fab config:set,<key>,<value> `
247+ Set remote config variables with ` fab config:set,<key>,<value> ` :
246248
247249 $ fab config:set,hello,world
248250
249- Get a single remote config variables with ` fab config:get,<key> `
251+ Get a single remote config variables with ` fab config:get,<key> ` :
250252
251253 $ fab config:get,hello
252254
253- Delete a remote config variables with ` fab config:unset,<key> `
255+ Delete a remote config variables with ` fab config:unset,<key> ` :
254256
255257 $ fab config:unset,hello
256258
257259Thanks entirely to fabric and not one bit to this project, you can chain
258- commands like so
260+ commands like so:
259261` fab config:set,<key1>,<value1> config:set,<key2>,<value2> `
260262
261263 $ fab config:set,hello,world config:set,foo,bar config:set,fizz=buzz
0 commit comments