Django and Podman ***************** - :doc:`sys-podman` - :doc:`dev-pyproject-uv` - Development_ - Release_ - Issues_ Development =========== :: # check branches kb.py # check branches - and switch if necessary kb.py --checkout # check branches - switch if necessary - and pull kb.py --checkout --pull uv pip install --group dev Release ======= :: # check branches kb.py # check branches - and switch if necessary kb.py --checkout # check branches - switch if necessary - and pull kb.py --checkout --pull # check uv is happy (although I think 'bump' does the same) uv sync # version number increment uv version --bump patch # add the files, then commit git commit -m "chore: 'pyproject.toml' - bump version" # release kb.py --release # push git push Build and Run ============= Build ----- Update the ``Dockerfile`` so it installs the correct version of your project e.g ``0.1.72``:: uv pip install kb-kbsoftware-couk==0.1.72 --group production --no-sources ... We use ``kb-podman.py`` to build the container from the ``Dockerfile`` e.g:: kb-podman.py --tag kbsoftware-couk .. tip:: The ``tag`` will be used as the name of the container. :: > podman container ls CONTAINER ID IMAGE NAMES 5d759639866b localhost/kbsoftware-couk:latest kbsoftware-couk-kbsoftware-couk Restore ------- :: kb.py --restore kb.py --restoredb /home/web/repo/backup/www.kbsoftware.co.uk/20250812_0100.sql podman exec -it kbsoftware-couk-kbsoftware-couk django-admin migrate --no-input Run --- :: podman kube play kbsoftware-couk.yaml --configmap=./config-map.yaml; and podman pod logs -f kbsoftware-couk Stop the container:: podman pod stop kbsoftware-couk; and podman pod rm kbsoftware-couk Issues ====== Logging ------- Logging needs to be to ``stdout`` do Podman can *see* the logs. This is the issue (using our standard configuration):: ValueError: Unable to configure handler 'logfile' FileNotFoundError: [Errno 2] No such file or directory: '/app/""/"www.kbsoftware.co.uk"-"dev"-logger.log' From `Dockerized Django Logging via Grafana Loki`_ To solve the issue, I commented out our ``logfile`` handler and changed everything to use the ``console`` handler (which already uses the ``logging.StreamHandler``). .. _`Dockerized Django Logging via Grafana Loki`: https://medium.com/@moeenz/dockerized-django-logging-via-grafana-loki-48464d13f8cb