Add narrative docs for app configuration
This commit is contained in:
parent
f9a7b41f94
commit
4641e24afd
11 changed files with 596 additions and 47 deletions
10
docs/narr/install/index.rst
Normal file
10
docs/narr/install/index.rst
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
Installation
|
||||
============
|
||||
|
||||
Read on for setup instructions etc.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
quickstart
|
49
docs/narr/install/quickstart.rst
Normal file
49
docs/narr/install/quickstart.rst
Normal file
|
@ -0,0 +1,49 @@
|
|||
|
||||
Quick Start
|
||||
===========
|
||||
|
||||
Install with:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
pip install wuttjamaican
|
||||
|
||||
Create a config file, e.g. ``my.conf``:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[foo]
|
||||
bar = A
|
||||
baz = 2
|
||||
feature = true
|
||||
words = the quick brown fox
|
||||
|
||||
In your app, load the config and reference its values as needed::
|
||||
|
||||
from wuttjamaican.conf import make_config
|
||||
|
||||
config = make_config('/path/to/my.conf')
|
||||
|
||||
# this call.. ..returns this value
|
||||
|
||||
config.get('foo.bar') # 'A'
|
||||
|
||||
config.get('foo.baz') # '2'
|
||||
config.get_int('foo.baz') # 2
|
||||
|
||||
config.get('foo.feature') # 'true'
|
||||
config.get_bool('foo.feature') # True
|
||||
|
||||
config.get('foo.words') # 'the quick brown fox'
|
||||
config.get_list('foo.words') # ['the', 'quick', 'brown', 'fox']
|
||||
|
||||
For more info see:
|
||||
|
||||
* :func:`~wuttjamaican.conf.make_config()`
|
||||
* :class:`~wuttjamaican.conf.WuttaConfig` and especially
|
||||
:meth:`~wuttjamaican.conf.WuttaConfig.get()`
|
||||
|
||||
You can also define your own command line interface; see:
|
||||
|
||||
* :class:`~wuttjamaican.commands.base.Command`
|
||||
* :class:`~wuttjamaican.commands.base.Subcommand`
|
Loading…
Add table
Add a link
Reference in a new issue