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.
- 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') )