-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-dev.sh
More file actions
63 lines (51 loc) · 1.93 KB
/
start-dev.sh
File metadata and controls
63 lines (51 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# RENTAL PASSPORT - Local Development Startup Script
echo "🏠 RENTAL PASSPORT - Starting Local Development Environment"
echo "=================================================="
# Check if Python is installed
if ! command -v python3 &> /dev/null; then
echo "❌ Python 3 is not installed. Please install Python 3.8+"
exit 1
fi
# Check if PostgreSQL is running
if ! command -v psql &> /dev/null; then
echo "⚠️ PostgreSQL not found. Please install PostgreSQL"
echo " Ubuntu/Debian: sudo apt-get install postgresql postgresql-contrib"
echo " macOS: brew install postgresql"
echo " Windows: Download from https://www.postgresql.org/download/"
fi
# Navigate to backend directory
cd backend
# Check if virtual environment exists
if [ ! -d "venv" ]; then
echo "📦 Creating Python virtual environment..."
python3 -m venv venv
fi
# Activate virtual environment
echo "🔧 Activating virtual environment..."
source venv/bin/activate
# Install dependencies
echo "📥 Installing Python dependencies..."
pip install -r requirements.txt
# Check if .env file exists
if [ ! -f ".env" ]; then
echo "⚙️ Creating .env file from template..."
cp .env.example .env
echo "📝 Please edit .env file with your configuration:"
echo " - Database URL"
echo " - JWT Secret Key"
echo " - AWS S3 Credentials"
echo ""
read -p "Press Enter to continue after configuring .env file..."
fi
# Create database if it doesn't exist
echo "🗄️ Setting up database..."
createdb rental_passport 2>/dev/null || echo "Database already exists or PostgreSQL not running"
# Start the backend server
echo "🚀 Starting backend server on http://localhost:8000"
echo "📚 API Documentation: http://localhost:8000/api/docs"
echo "❤️ Health Check: http://localhost:8000/api/health"
echo ""
echo "Press Ctrl+C to stop the server"
echo "=================================================="
python main.py