id-python/members — pull request #14 by iromli (2014-07-02 13:57:01+00:00)
Title: Simplified config take 2

This changeset introduces [flask-appconfig][] integration to manage app configuration loading. By using this extension, we have more possibilities to configure the app:

1. Use default config `users/config.py`.

2. Use default config and override necessary values using user-defined config file.

Default config:

```python
# users/config.py
MAIL_SUPPRESS_SEND=False
DEBUG = False
```

Custom config:

```python
# /path/to/custom_config.py
MAIL_SUPPRESS_SEND=True
DEBUG = True
```

Example usage:

```sh
USERS_CONFIG=/path/to/custom_config.py python runserver.py
```

3. Use default config and override necessary values using environment variable.

Default config:

```python
# users/config.py
MAIL_SUPPRESS_SEND=False
DEBUG = False
```

By using enviroment variable, we could override specific item, for example:

```sh
USERS_MAIL_SUPPRESS_SEND=True USERS_DEBUG=True ./runtests.sh
```

Note, to use the environment variable properly, the `USERS_` prefix must exist.

Now we have more control on how to configure app in various usecases, e.g. Travis CI integration and so on.

[flask-appconfig]: https://github.com/mbr/flask-appconfig