Include instance folder in git and improve setup

- Updated .gitignore to include instance folder but exclude sensitive files
- Added instance/README.md with setup instructions
- Updated setup script with better configuration examples
- Instance folder will now be tracked in git to preserve quotes.db
This commit is contained in:
2025-09-20 20:09:15 +01:00
parent 3dbb181cb0
commit 4b31d3b9e0
4 changed files with 20 additions and 11 deletions

8
.gitignore vendored
View File

@@ -2,8 +2,9 @@
venv/
.venv/
# Flask instance folder
instance/
# Flask instance folder - keep the folder but ignore sensitive files
instance/flask_secret_key
instance/*.log
# Python
__pycache__/
@@ -12,8 +13,7 @@ __pycache__/
*.pyd
.Python
# Database files
*.db
# Database WAL files (keep main .db file)
*.db-shm
*.db-wal

2
instance/README.md Normal file
View File

@@ -0,0 +1,2 @@
# This file will be generated automatically on each server
# Run: python -c "import secrets; print(secrets.token_hex(32))" > instance/flask_secret_key

BIN
instance/quotes.db Normal file

Binary file not shown.

View File

@@ -5,17 +5,19 @@
echo "Setting up ircquotes on production server..."
# Create instance directory
echo "Creating instance directory..."
# Instance directory should already exist from git
# But create it if it doesn't
mkdir -p instance
# Generate secret key
echo "Generating Flask secret key..."
python3 -c "import secrets; print(secrets.token_hex(32))" > instance/flask_secret_key
# Create empty database file
# Create empty database file if it doesn't exist
if [ ! -f "instance/quotes.db" ]; then
echo "Creating database file..."
touch instance/quotes.db
fi
# Set permissions
echo "Setting file permissions..."
@@ -42,9 +44,14 @@ echo " python generate_password.py"
echo " python config_manager.py admin.username 'yourusername'"
echo " python config_manager.py admin.password_hash 'generated_hash'"
echo ""
echo "2. Start the application:"
echo "2. Configure other settings:"
echo " python config_manager.py app.port 6969"
echo " python config_manager.py quotes.min_length 1"
echo " python config_manager.py quotes.max_length 10000"
echo ""
echo "3. Start the application:"
echo " source .venv/bin/activate"
echo " gunicorn --config gunicorn.conf.py app:app"
echo ""
echo "3. Or run in development mode:"
echo "4. Or run in development mode:"
echo " python app.py"