-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·62 lines (53 loc) · 1.72 KB
/
start.sh
File metadata and controls
executable file
·62 lines (53 loc) · 1.72 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
#!/usr/bin/env bash
set -e
echo "Starting ZineCore2 Development Server"
echo "======================================"
echo ""
# Load .env so Django and docker compose share the same config
if [ -f .env ]; then
set -a
source .env
set +a
fi
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if docker compose is running
echo "Checking Docker services..."
if ! docker compose ps --status running 2>/dev/null | grep -q "db"; then
echo "Starting Docker Compose..."
docker compose up -d --wait
echo -e "${GREEN}PostgreSQL started${NC}"
else
echo -e "${GREEN}PostgreSQL already running${NC}"
fi
echo ""
# Ensure spec submodule is available
if [ ! -d "spec/vocabularies/canonical" ]; then
echo -e "${YELLOW}Initializing spec submodule...${NC}"
git submodule update --init spec
echo -e "${GREEN}Spec submodule ready${NC}"
echo ""
fi
# Run any pending migrations
echo "Checking for pending migrations..."
DJANGO_SETTINGS_MODULE=zinecore.settings.development \
.venv/bin/python backend/manage.py migrate --check --no-input 2>/dev/null || {
echo -e "${YELLOW}Running pending migrations...${NC}"
DJANGO_SETTINGS_MODULE=zinecore.settings.development \
.venv/bin/python backend/manage.py migrate
}
echo -e "${GREEN}Database is up to date${NC}"
echo ""
echo "Starting Django development server..."
echo ""
echo "Services available at:"
echo " API: http://localhost:8000/api/"
echo " Admin: http://localhost:8000/admin/"
echo " Swagger docs: http://localhost:8000/api/docs/"
echo ""
echo "Press Ctrl+C to stop"
echo ""
DJANGO_SETTINGS_MODULE=zinecore.settings.development \
.venv/bin/python backend/manage.py runserver_plus 0.0.0.0:8000