Simple deployment od django
1. copy file to server user scp
代码语言:shell复制# scp -p port source_path user@target:target_path
scp ./xxxx.zip root@xxxx:/xxxxx
or maybe try connect by afp, map server folder to finder
代码语言:shell复制sudo apt-get install netatalk
## netatalk config ##
sudo vim /etc/default/netatalk
## config ##
# ATALKD_RUN=no
# PAPD_RUN=no
# CNID_METAD_RUN=yes
# AFPD_RUN=yes
# TIMELORD_RUN=no
# A2BOOT_RUN=no
## share folder ##
sudo vim /etc/netatalk/AppleVolumes.default
# ~/ "Home Directory"
# /path/ "path dir for share"
## restart nettalk ##
sudo /etc/init.d/netatalk restart
### do in mac ###
atp://192.168.yourip
2. build script for django save as start.sh
代码语言:python代码运行次数:0复制## setting.py ##
# ALLOWED_HOSTS = ['*']
# shell script
clean=false
build=false
cd /x/xxx
if $clean; then
rm -f ./db.sqlite3
rm -rf ./xxx/__pycache__/
rm -rf ./xxx/__pycache__/
rm -rf ./xxx/migrations/
fi
if $build; then
python3 ./manage.py migrate
python3 ./manage.py makemigrations cpsource
python3 ./manage.py migrate
python3 ./manage.py createsuperuser --username root --email xxx@xxx.com
fi
python3 manage.py runserver 0.0.0.0:8080
# nohup python3 manage.py runserver 0.0.0.0:8000 > ./demo.log 2&>1 &
# google-chrome &
### for short ###
# nohup python manage.py runserver 0.0.0.0:8000 &
3. run the script
代码语言:shell复制### running ###
nohup /root/start.sh &
### check ###
ps -ef | grep 'python3'
# kill -9 xxxxx
check in browser with http and port(8000), mark for next demo