The version of Django that Toaster uses is specified on the /opt/yocto/poky/bitbake/toaster-requirements.txt file, for example:
Django>1.8,<1.9.9
Django and hence Toaster store data in a relational database. The backend configuration is done in the /opt/yocto/poky/bitbake/lib/toaster/toastermain/settings.py file as follows:
TOASTER_SQLITE_DEFAULT_DIR = os.environ.get('TOASTER_DIR')
DATABASES = {
'default': {
# Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'ENGINE': 'django.db.backends.sqlite3',
# DB name or full path to database file if using sqlite3.
'NAME': "%s/toaster.sqlite" % TOASTER_SQLITE_DEFAULT_DIR,
'USER': '',
'PASSWORD': '',
#'HOST': '127.0.0.1', # e.g. mysql server
#'PORT': '3306', # e.g. mysql port
}
}
By default, Toaster will create a toaster.sqlite database on the configured TOASTER_DIR path. For production servers, MySQL is the recommended backend.
Django has a built in object-relational mapper, Django ORM, which automates the transfer of data from the relational database to Python objects and allows database accesses in Python code. The initial state of the database is created from a set of fixtures (data dumps) under /opt/yocto/poky/bitbake/lib/toaster/orm/fixtures. Toaster fixtures are in XML format:
- settings.xml: This contains Toaster and BitBake variable settings. Some of these can be changed through the Toaster administrative interface.
- poky.xml and oe-core.xml: These are defaults for both the Poky and OE-core builds.
- custom.xml: This allows you to override data on any of the preceding fixtures with a custom configuration. XML, JSON, and YAML formats are all supported.
When Toaster is launched, these Django fixtures are used to populate its database with initial data.
Toaster has extended the Django manage.py command with some custom Toaster-specific options. The manage.py management script needs to be invoked from the build directory, which contains the Toaster database:
$ cd /opt/yocto/poky/build
$ /opt/yocto/poky/bitbake/lib/toaster/manage.py <command> [<command option>]
The commands can be the following:
From /opt/yocto/poky/bitbake/lib/toaster/toastermain/managements/commands/:
- buildlist: This returns the current build list including their build IDs
- buildelete <build_id>: This deletes all build dates for the build specified by its build ID
- checksocket: This verifies that Toaster can bind to the provided IP address and port
- perf: This is a sanity check that measures performance by returning page loading times
From /opt/yocto/poky/bitbake/lib/toaster/orm/managements/commands/:
- lsupdates: This updates the local layer index cache
From /opt/yocto/poky/bitbake/lib/toaster/bldcontrol/managements/commands/:
- checksettings: This verifies that the existing Toaster database settings are enough to start a build
- runbuilds: This launches scheduled builds