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 continuemax_retries (int) – a number of attempts to reach cache backend, default is
100retry_timeout (int) – a timeout in seconds between attempts, default is
5
- Return type
bool- Returns
Trueif all backends are availableFalseif any backend check failed
- 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 continuemax_retries (int) – number of attempts to reach every database; default is
100retry_timeout (int) – timeout in seconds between attempts
- Return type
bool- Returns
Trueif all backends are available,Falseif any backend check failed
- django_docker_helpers.db.migrate(*argv)[source]¶
Runs Django migrate command.
- Return type
bool- Returns
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
bool- Returns
Noneif modeltranslation is not specified isINSTALLED_APPS,Trueif all synced.