44 lines
809 B
Bash
Executable File
44 lines
809 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# echo "export PROJECT_NAME=value" >> ~/.bashrc
|
|
|
|
# Check if project_name arugment is provided
|
|
# if [ $# -ne 1 ]; then
|
|
# echo "Usage: $0 <project_name>"
|
|
# exit 1
|
|
# fi
|
|
|
|
# project_name=$1
|
|
|
|
|
|
if [ -z "$PROJECT_NAME" ]; then
|
|
echo "Error: PROJECT_NAME is not set."
|
|
exit 1
|
|
fi
|
|
|
|
|
|
|
|
# Change to your desired directory
|
|
cd /var/www/$PROJECT_NAME
|
|
|
|
# Perform a git pull
|
|
git pull
|
|
git submodule init
|
|
git submodule update
|
|
|
|
# Activate virtual environment
|
|
source /var/www/venvs/$PROJECT_NAME/bin/activate
|
|
|
|
# Collect static files
|
|
python manage.py collectstatic --noinput
|
|
|
|
# Create database migrations
|
|
python manage.py makemigrations
|
|
|
|
# Apply database migrations
|
|
python manage.py migrate
|
|
|
|
# Restart supervisor processes
|
|
sudo supervisorctl restart $PROJECT_NAME
|
|
sudo supervisorctl restart "$PROJECT_NAME"_celery
|