Data models for the Deis API.

class api.models.App(*args, **kwargs)[source]

Application used to service requests on behalf of end-users

create(*args, **kwargs)[source]

Create a new application with an initial config and release

delete(*args, **kwargs)[source]

Delete this application including all containers

deploy(user, release)[source]

Deploy a new release to this application


Logs a message to the application’s log file.

This is a workaround for how Django interacts with Python’s logging module. Each app needs its own FileHandler instance so it can write to its own log file. That won’t work in Django’s case because logging is set up before you run the server and it disables all existing logging configurations.


Return aggregated log data for this application.

run(user, command)[source]

Run a one-off command in an ephemeral app container.

scale(user, structure)[source]

Scale containers up or down to match requested structure.

class api.models.AuditedModel(*args, **kwargs)[source]

Add created and updated fields to a model.

class Meta[source]

Mark AuditedModel as abstract.

class api.models.Build(*args, **kwargs)[source]

Instance of a software build used by runtime nodes

class api.models.Certificate(*args, **kwargs)[source]

Public and private key pair used to secure application traffic at the router.

class api.models.Config(*args, **kwargs)[source]

Set of configuration values applied as environment variables during runtime execution of the Application.


merge the old config with the new

class api.models.Container(*args, **kwargs)[source]

Docker container used to securely host an application process.


Run a one-off command

class api.models.Domain(id, created, updated, owner_id, app_id, domain)[source]
class api.models.Key(*args, **kwargs)[source]

An SSH public key.

class api.models.Push(*args, **kwargs)[source]

Instance of a push used to trigger an application build

class api.models.Release(*args, **kwargs)[source]

Software release deployed by the application platform

Releases contain a Build and a Config.

new(user, config, build, summary=None, source_version=u'latest')[source]

Create a new application release using the provided Build and Config on behalf of a user.

Releases start at v1 and auto-increment.


Return the previous Release to this one.

Returns:the previous Release, or None
class api.models.UuidAuditedModel(*args, **kwargs)[source]

Add a UUID primary key to an AuditedModel.

class Meta[source]

Mark UuidAuditedModel as abstract.

api.models.close_db_connections(func, *args, **kwargs)[source]

Decorator to explicitly close db connections during threaded execution

Note this is necessary to work around: https://code.djangoproject.com/ticket/22420


Select a unique randomly generated app name


Error if the dict values aren’t ints >= 0.


Check that value contains only valid base64 characters.


Error if the value doesn’t look like a list of hostnames or IP addresses separated by commas.


Error if the domain contains unexpected characters.


Check that the ID follows docker’s image name constraints


A value cannot use some reserved names.