FileServer/setup.sh

72 lines
2.0 KiB
Bash

#!/bin/bash
echo "🚀 Setting up Das File Storage Application..."
# Create necessary directories
echo "📁 Creating directories..."
mkdir -p uploads
mkdir -p templates
# Check if templates exist
if [ ! -f "templates/base.html" ]; then
echo "⚠️ Warning: Template files not found in templates/ directory"
echo "Please make sure to copy all HTML template files to the templates/ directory:"
echo " - base.html"
echo " - login.html"
echo " - user_files.html"
echo " - settings.html"
echo " - admin.html"
fi
# Create .env if it doesn't exist
if [ ! -f ".env" ]; then
echo "📝 Creating .env file..."
cp .env.example .env
echo "✅ Created .env file. Please update with your database credentials."
fi
# Check if Python is installed
if ! command -v python3 &> /dev/null; then
echo "❌ Python 3 is not installed. Please install Python 3.8 or higher."
exit 1
fi
# Check if PostgreSQL is running (optional check)
if command -v pg_isready &> /dev/null; then
if pg_isready &> /dev/null; then
echo "✅ PostgreSQL is running"
else
echo "⚠️ PostgreSQL is not running. Please start PostgreSQL."
fi
fi
# Create virtual environment
if [ ! -d "venv" ]; then
echo "🐍 Creating virtual environment..."
python3 -m venv venv
fi
# Activate virtual environment
echo "🔧 Activating virtual environment..."
source venv/bin/activate
# Install requirements
echo "📦 Installing Python packages..."
pip install --upgrade pip
pip install -r requirements.txt
echo ""
echo "✅ Setup complete!"
echo ""
echo "📋 Next steps:"
echo "1. Update .env file with your PostgreSQL credentials"
echo "2. Make sure all template files are in the templates/ directory"
echo "3. Create PostgreSQL database: createdb filestore"
echo "4. Run the application: python main.py"
echo "5. Open browser: http://localhost:8000"
echo "6. Login with default admin credentials:"
echo " Username: admin"
echo " Password: admin123"
echo ""
echo "⚠️ Remember to change the admin password immediately!"
echo ""