conf

The global configuration of a Camelot application is handled through a LazyProxy object that reads settings from various targets. The default target reads the attributes from the ‘settings’ module, if this is found on the PYTHONPATH.

To access the global configuration, simply import the settings object:

from camelot.core.conf import settings

print(settings.CAMELOT_MEDIA_ROOT)

Developers can add targets to the settings proxy, to enable reading settings from other sources.

class camelot.core.conf.LazyProxy[source]

A lazy proxy of the ‘settings’ module on the PYTHONPATH, or other targets that contain global configuration. This proxy behaves as a list to which targets can be appended. The value of the first target in the list that has the requested attribute will be returned.

The Proxy is Lazy, because on each request of an attribute, the target is queried again.

append_settings_module()[source]

Import the ‘settings’ module and append it as a target to the list of targets. This function will be called, if no other targets are specified

get(name, default=None)[source]

Get an attribute of the proxy, and when not found return default as value. This function behaves the same as the get function of a dictionary.

class camelot.core.conf.SimpleSettings(author, name, data='data.sqlite')[source]

Settings that can be used for the creation of a simple Camelot application. Use these settings by appending them to the global settings at application startup:

from camelot.core.conf import settings, SimpleSettings

settings.append( SimpleSettings('myapp') )