写一个简单的运行Django项目的脚本

2021-03-03 11:53:45 浏览数 (1)

代码语言:javascript复制
#!/bin/sh

echo -e "33[32m killed original process 33[0m"
project_name="tax_backend"
env_name="tax_backend"

echo "name = $name"
ids=`ps -ef | grep "$project_name" | grep -v grep | awk '{print $2}'`
echo "ids = $ids "
for id in $ids; do
    kill -9 $id
    echo "killed $id"
done

echo -e "n"
echo -e "33[32m entry $env_name environment 33[0m"
source /usr/local/python3/bin/virtualenvwrapper.sh
workon $env_name

echo -e "n"
echo -e "33[32m install requirement 33[0m"
cd /root/project/tax_backend
pip3 install -r requirement.txt

echo -e "n"
echo -e "33[32m run project 33[0m"
nohup python manage.py runserver 0.0.0.0:8000 &

echo -e "n"
echo -e "33[32m quit tax_backend environment 33[0m"
deactivate

0 人点赞