Skip to content

Instantly share code, notes, and snippets.

@JayH5
Last active November 23, 2017 08:10
Show Gist options
  • Save JayH5/9ee8844b834fff2a0f6cb05beb7e9b9f to your computer and use it in GitHub Desktop.
Save JayH5/9ee8844b834fff2a0f6cb05beb7e9b9f to your computer and use it in GitHub Desktop.
Django container fixture
from seaworthy.definitions import ContainerDefinition
class DjangoContainer(ContainerDefinition):
IMAGE = "seaworthy-demo:django"
WAIT_PATTERNS = (r"Booting worker",)
def __init__(self, name, socket_volume, static_volume, db_url):
super().__init__(name, self.IMAGE, self.WAIT_PATTERNS)
self.socket_volume = socket_volume
self.static_volume = static_volume
self.db_url = db_url
def base_kwargs(self):
return {
"volumes": {
self.socket_volume.inner(): "/var/run/gunicorn",
self.static_volume.inner(): "/app/static:ro",
},
"environment": {"DATABASE_URL": self.db_url}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment