-
Notifications
You must be signed in to change notification settings - Fork 0
/
startup.sh
54 lines (42 loc) · 1.2 KB
/
startup.sh
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
#!/bin/bash
venv_name="csc309_p2"
if ! command -v python3 &> /dev/null; then
echo "Installing Python 3..."
sudo apt-get update
sudo apt-get install -y python3
else
echo "Python 3 is already installed."
fi
if ! dpkg -s python3.8-distutils &> /dev/null; then
echo "Installing python3.8-distutils..."
sudo apt-get update
sudo apt-get install -y python3.8-distutils
else
echo "python3.8-distutils is already installed."
fi
# Check if virtualenv is installed, if not, install it
if ! command -v virtualenv &> /dev/null
then
echo "Installing virtualenv"
pip install virtualenv
fi
# Create a virtual environment
if [ ! -d "$venv_name" ]
then
echo "Creating virtual environment"
virtualenv "$venv_name"
fi
# Activate virtual environment
echo "Activating virtual environment"
source "$venv_name"/bin/activate
# Install required Python packages
echo "Installing required Python packages"
pip install django pillow djangorestframework djangorestframework-simplejwt drf-yasg
cd p2
# Make Django migrations
echo "Making Django migrations..."
python manage.py makemigrations
# Migrate migrations
echo "Running Django migrations..."
python manage.py migrate
echo "Setup completed"