diff --git a/.gitignore b/.gitignore index 0db6a0b..311afc3 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/instance/README.md b/instance/README.md new file mode 100644 index 0000000..cd73d3f --- /dev/null +++ b/instance/README.md @@ -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 \ No newline at end of file diff --git a/instance/quotes.db b/instance/quotes.db new file mode 100644 index 0000000..d97b86c Binary files /dev/null and b/instance/quotes.db differ diff --git a/setup.sh b/setup.sh index 36241db..c769c3e 100644 --- a/setup.sh +++ b/setup.sh @@ -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 -echo "Creating database file..." -touch instance/quotes.db +# 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" \ No newline at end of file