Skip to content

Commit ade8065

Browse files
committed
Improve README: fix examples and typos
1 parent 32525c0 commit ade8065

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

README.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Example: How do I use it with Django?
130130
Given that I have a ``.env`` file at my repository root directory, here is a snippet of my ``settings.py``.
131131

132132
I also recommend using `unipath <https://pypi.python.org/pypi/Unipath>`_
133-
and `dj-datatabase-url <https://pypi.python.org/pypi/dj-database-url/>`_.
133+
and `dj-database-url <https://pypi.python.org/pypi/dj-database-url/>`_.
134134

135135
.. code-block:: python
136136
@@ -182,9 +182,10 @@ Overriding config files with environment variables
182182

183183
Some times you may want to change a parameter value without having to edit the ``.ini`` or ``.env`` files.
184184

185-
Since version 3.0, *decouple* respect the *unix way*. So environment variables have precedence over config files.
185+
Since version 3.0, *decouple* respect the *unix way*.
186+
Therefore environment variables have precedence over config files.
186187

187-
To override a config parameter you can simply:
188+
To override a config parameter you can simply do:
188189

189190
.. code-block:: console
190191
@@ -258,7 +259,7 @@ Let's see some examples for the above mentioned cases:
258259
259260
>>> os.environ['ALLOWED_HOSTS'] = '.localhost, .herokuapp.com'
260261
>>> config('ALLOWED_HOSTS', cast=lambda v: [s.strip() for s in v.split(',')])
261-
['.localhost,', '.herokuapp.com']
262+
['.localhost', '.herokuapp.com']
262263
263264
As you can see, `cast` is very flexible. But the last example got a bit complex.
264265

@@ -271,9 +272,10 @@ Let's improve the last example:
271272

272273
.. code-block:: pycon
273274
275+
>>> from decouple import Csv
274276
>>> os.environ['ALLOWED_HOSTS'] = '.localhost, .herokuapp.com'
275277
>>> config('ALLOWED_HOSTS', cast=Csv())
276-
['.localhost,', '.herokuapp.com']
278+
['.localhost', '.herokuapp.com']
277279
278280
You can also parametrize the *Csv Helper* to return other types of data.
279281

@@ -285,9 +287,8 @@ You can also parametrize the *Csv Helper* to return other types of data.
285287
286288
>>> os.environ['COMPLEX_STRING'] = '%virtual_env%\t *important stuff*\t trailing spaces '
287289
>>> csv = Csv(cast=lambda s: s.upper(), delimiter='\t', strip=' %*')
288-
>>> csv('%virtual_env%\t *important stuff*\t trailing spaces ')
290+
>>> csv(os.environ['COMPLEX_STRING'])
289291
['VIRTUAL_ENV', 'IMPORTANT STUFF', 'TRAILING SPACES']
290-
"""
291292
292293
License
293294
=======

0 commit comments

Comments
 (0)