diff --git a/README.md b/README.md index 558f5e7..2cef2ba 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,17 @@ Note: Docker will automatically load the `.env` file from your project root The application will be available at `http://localhost:5001` ### Persisting Data -The database will be preserved between container restarts through the `./instance` volume mount. +The database file (database.db) will be preserved between container restarts through the `./instance` volume mount. + +**Important:** After renaming the database: +1. Delete the old database file if it exists: +```bash +rm instance/users.db +``` +2. Reinitialize the database: +```bash +flask init-db +``` ## Configuration diff --git a/app.py b/app.py index 27f184d..4a8d101 100644 --- a/app.py +++ b/app.py @@ -9,7 +9,7 @@ app.config["SECRET_KEY"] = os.environ.get( "FLASK_SECRET_KEY", "your-secret-key-here" # Fallback for development only ) app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///" + os.path.join( - os.path.abspath(os.path.dirname(__file__)), "instance/users.db" + os.path.abspath(os.path.dirname(__file__)), "instance/database.db" ) app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False diff --git a/docker-compose.yml b/docker-compose.yml index a28611e..da92fd8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,6 @@ services: environment: - FLASK_ENV=production - FLASK_SECRET_KEY=${FLASK_SECRET_KEY} # Required - set in .env file - - SQLALCHEMY_DATABASE_URI=sqlite:////app/instance/users.db + - SQLALCHEMY_DATABASE_URI=sqlite:////app/instance/database.db volumes: - ./instance:/app/instance