This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Backup the data. Taken from https://stackoverflow.com/a/67568671/7058363 | |
docker volume create --name backup_volume | |
docker container run --rm -it -v [old volume]:/from -v backup_volume:/to alpine ash -c "cd /from ; cp -av . /to" | |
# Export Postgres data | |
docker exec -t [name of DB container] pg_dump [db name] | gzip > exported_postgres_data.sql.gz | |
# MANUAL: stop the Docker container to which the volume is attached... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django import template | |
from django.contrib.staticfiles.finders import find as find_static_file | |
import base64 | |
register = template.Library() | |
def get_file_data(file_path: str) -> bytes: | |
""" | |
@param file_path: Path of the file to get the data |