Docker-compose mode - db.sqlite3 at root - not a persistent storage
vincentporte opened this issue · comments
Vincent Porte commented
db.sqlite3 stored at ~/fastapi-beginners-guide, which is map as / in docker container.
This is not a persistent storage.
Need to move database files to ~/fastapi-beginners-guide/db/ and map this dir as /db:/fastapi-beginners-guide/db in docker-compose.yml
Vincent Porte commented
quick patch in main.py
# quick and dirty fix for https://github.com/tortoise/tortoise-orm/issues/529
# patch Tortoise's FastAPI contrib module with custom logger
import logging
from tortoise.contrib import fastapi
fastapi.logging = logging.getLogger('uvicorn')
# end of patch
app = FastAPI()
…