Skip to content

settings

Django settings for lwmdb project.

Generated by ‘django-admin startproject’ using Django 4.0. For more information on this file, see

https://docs.djangoproject.com/en/4.0/topics/settings/ https://docs.djangoproject.com/en/4.0/ref/settings/

is_docker

is_docker()

Test if currently running in Docker.

See https://stackoverflow.com/questions/43878953/how-does-one- detect-if-one-is-running-within-a-docker-container-within-python

Source code in config/settings.py
def is_docker():
    """Test if currently running in Docker.

    See https://stackoverflow.com/questions/43878953/how-does-one-
    detect-if-one-is-running-within-a-docker-container-within-python
    """
    cgroup = Path("/proc/self/cgroup")
    return (
        Path("/.dockerenv").is_file()
        or cgroup.is_file()
        and cgroup.read_text().find("docker") > -1
    )