This commit is contained in:
Iliyan Angelov
2025-11-25 02:06:38 +02:00
parent 2f6dca736a
commit 82024016cd
37 changed files with 1800 additions and 1478 deletions

34
switch-to-sqlite.sh Normal file
View File

@@ -0,0 +1,34 @@
#!/bin/bash
# Switch Django backend to use SQLite instead of PostgreSQL
BACKEND_DIR="/var/www/GNX-WEB/backEnd"
BACKEND_ENV="$BACKEND_DIR/.env"
echo "Switching to SQLite database..."
if [ -f "$BACKEND_ENV" ]; then
# Comment out or remove DATABASE_URL line
if grep -q "^DATABASE_URL=" "$BACKEND_ENV"; then
echo "Commenting out DATABASE_URL to use SQLite..."
sed -i 's|^DATABASE_URL=.*|# DATABASE_URL= # Using SQLite instead|' "$BACKEND_ENV"
echo "✓ DATABASE_URL commented out"
fi
# Ensure db.sqlite3 path is correct (it should be in backEnd directory)
echo ""
echo "SQLite database will be at: $BACKEND_DIR/db.sqlite3"
echo ""
echo "Restarting backend to apply changes..."
pm2 restart gnxsoft-backend
echo "✓ Backend restarted"
echo ""
echo "Checking database connection..."
cd "$BACKEND_DIR"
source venv/bin/activate
python manage.py check --database default
else
echo "Error: .env file not found at $BACKEND_ENV"
exit 1
fi