Database¶
-
django_docker_helpers.db.ensure_caches_alive(max_retries=100, retry_timeout=5, exit_on_failure=True)[source]¶ Checks every cache backend alias in
settings.CACHESuntil it becomes available. Aftermax_retriesattempts to reach any backend are failed it returnsFalse. Ifexit_on_failureis set it shuts down withexit(1).It sets the
django-docker-helpers:available-checkkey for every cache backend to ensure it’s receiving connections. If check is passed the key is deleted.Parameters: - exit_on_failure (
bool) – set toTrueif there’s no sense to continue - max_retries (int) – a number of attempts to reach cache backend, default is
100 - retry_timeout (int) – a timeout in seconds between attempts, default is
5
Return type: boolReturns: Trueif all backends are availableFalseif any backend check failed- exit_on_failure (
-
django_docker_helpers.db.ensure_databases_alive(max_retries=100, retry_timeout=5, exit_on_failure=True)[source]¶ Checks every database alias in
settings.DATABASESuntil it becomes available. Aftermax_retriesattempts to reach any backend are failed it returnsFalse. Ifexit_on_failureis set it shuts down withexit(1).For every database alias it tries to
SELECT 1. If no errors raised it checks the next alias.Parameters: - exit_on_failure (
bool) – set toTrueif there’s no sense to continue - max_retries (int) – number of attempts to reach every database; default is
100 - retry_timeout (int) – timeout in seconds between attempts
Return type: boolReturns: Trueif all backends are available,Falseif any backend check failed- exit_on_failure (
-
django_docker_helpers.db.migrate(*argv)[source]¶ Runs Django migrate command.
Return type: boolReturns: always True
-
django_docker_helpers.db.modeltranslation_sync_translation_fields()[source]¶ Runs
modeltranslation’ssync_translation_fieldsmanage.py command:execute_from_command_line(['./manage.py', 'sync_translation_fields', '--noinput'])Return type: boolReturns: Noneif modeltranslation is not specified isINSTALLED_APPS,Trueif all synced.