Understanding Kotti’s startup phase¶
- When a Kotti application is started the kotti.main() function is called by the WSGI server and is passed a settings dictionary that contains all key / value pairs from the [app:kotti] section of the *.ini file.
- The settings dictionary is passed to kotti.base_configure().
This is where the main work happens:
- Every key in kotti.conf_defaults that is not in the settings dictionary (i.e. that is not in the .ini file) is copied to the settings dictionary, together with the default value for that key.
- Add-on initializations: all functions that are listed in the kotti.configurators parameter are resolved and called.
- pyramid.includes are removed from the settings dictionary for later processing, i.e. after kotti.base_includes.
- A class:pyramid.config.Configurator is instanciated with the remaining settings.
- The kotti.base_includes (containing various Kotti subsystems, such as kotti.events, kotti.views, etc.) are passed to config.include.
- The pyramid.includes that were removed from the settings dictionary in step 2.3 are processed.
- The kotti.zcml_includes are processed.
- The SQLAlchemy engine is created with the connection URL that is defined in the sqlalchemy.url parameter in the .ini file.
- The fully configured WSGI application is returned to the WSGI server and is ready to process requests.