-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·88 lines (72 loc) · 2.64 KB
/
start.sh
File metadata and controls
executable file
·88 lines (72 loc) · 2.64 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
# NoteByNote Application Startup Script
# Display banner
echo "=========================================================="
echo " _ _ _ ______ _ _ _ "
echo "| \ | | | | | ___ \ | \ | | | | "
echo "| \| | ___ | |_ ___| |_/ /_ _| \| | ___ | |_ ___ "
echo "| . \` |/ _ \| __/ _ \ ___ \ | | | . \` |/ _ \| __/ _ \\"
echo "| |\ | (_) | || __/ |_/ / |_| | |\ | (_) | || __/"
echo "\_| \_/\___/ \__\___\____/ \__, \_| \_/\___/ \__\___|"
echo " __/ | "
echo " |___/ "
echo "=========================================================="
echo " Fragrance Formulation & Analysis Platform"
echo "==============================================="
# Check for virtual environment and create if it doesn't exist
if [ ! -d "venv" ]; then
echo "[INFO] Setting up virtual environment..."
python3 -m venv venv
if [ $? -ne 0 ]; then
echo "[ERROR] Failed to create virtual environment. Please install Python 3.8+ and try again."
exit 1
fi
fi
# Activate virtual environment
echo "[INFO] Activating virtual environment..."
source venv/bin/activate
# Check if pip needs upgrading
pip install --upgrade pip
# Install/update dependencies
echo "[INFO] Installing dependencies..."
pip install -e .
# Check if .env file exists, create template if not
if [ ! -f ".env" ]; then
echo "[INFO] Creating .env file template..."
cat > .env << EOF
# NoteByNote Environment Configuration
# Flask Settings
FLASK_APP=run.py
FLASK_ENV=development
SECRET_KEY=your_secure_secret_key_here
# Database Settings
SQLALCHEMY_DATABASE_URI=sqlite:///instance/notebynote.db
SQLALCHEMY_TRACK_MODIFICATIONS=False
# Mail Settings
MAIL_SERVER=smtp.example.com
MAIL_PORT=587
MAIL_USE_TLS=True
MAIL_USERNAME=your_email@example.com
MAIL_PASSWORD=your_mail_password
MAIL_DEFAULT_SENDER=your_email@example.com
# Application Settings
ADMIN_EMAIL=admin@example.com
EOF
echo "[NOTICE] A new .env file has been created. Please edit it with your configuration."
fi
# Check if database exists
if [ ! -f "instance/notebynote.db" ]; then
echo "[INFO] Database not found. Running database initialization..."
mkdir -p instance
python -m flask db init
python -m flask db migrate -m "Initial migration"
python -m flask db upgrade
echo "[NOTICE] Would you like to create an admin user? (y/n)"
read create_admin
if [ "$create_admin" = "y" ] || [ "$create_admin" = "Y" ]; then
python SetUpfiles/create_db.py
fi
fi
# Start application
echo "[INFO] Starting NoteByNote application..."
python run.py