Application configuration

FrescoApp has an options property that can be used for your application’s configuration. A common pattern is for your application to provide default settings in a module or dictionary, then allow runtime settings to be loaded from a python file:

default_options = {'DATABASE': 'sqlite://'}

app = FrescoApp()

# Load default options

# Load other options from the file specified in the environment variable
# 'MYAPP_SETTINGS', defaulting to '' if unspecified.

You can access configuration options from any point in your application via

from fresco import context

db = connect(


Your settings file should be a regular python module containing variable definitions for each configuration option, for example:

DATABASE = 'sqlite:///tmp/myapp.db'

Variable names beginning with underscores will be ignored. You can use this feature to avoid polluting your options with unwanted symbols. In this example the ENTROPY option will be available in app.options, but the helper function will not be:

def _read_file(filename):
    with open(filename, 'r') as f:

ENTROPY = _read_file('conf/.entropy')

As with a regular python module you can use __all__ to specify which variables are loaded from your module.