renamed db from users.db to database.db

This commit is contained in:
Andreas Jönsson 2025-11-15 21:10:36 +01:00
parent 1a6f4abca0
commit 6cbbc36410
3 changed files with 13 additions and 3 deletions

View File

@ -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` The application will be available at `http://localhost:5001`
### Persisting Data ### 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 ## Configuration

2
app.py
View File

@ -9,7 +9,7 @@ app.config["SECRET_KEY"] = os.environ.get(
"FLASK_SECRET_KEY", "your-secret-key-here" # Fallback for development only "FLASK_SECRET_KEY", "your-secret-key-here" # Fallback for development only
) )
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///" + os.path.join( 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 app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False

View File

@ -8,6 +8,6 @@ services:
environment: environment:
- FLASK_ENV=production - FLASK_ENV=production
- FLASK_SECRET_KEY=${FLASK_SECRET_KEY} # Required - set in .env file - 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: volumes:
- ./instance:/app/instance - ./instance:/app/instance