前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Django Deployment

Django Deployment

原创
作者头像
vanguard
修改2021-01-05 10:36:43
5570
修改2021-01-05 10:36:43
举报
文章被收录于专栏:vanguardvanguard

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
复制
## 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

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档