前端
第一步
npm run build 生成dist文件夹
第二步
使用xshell进入linux 服务器,用刚生成的dist文件夹替换掉服务器中的dist文件夹
第三步
此过程仅限于使用了ngnix进行了前端的转发
ngnix配置文件中
比如监听了端口8080
识别/ 便会 转发到服务器中的dist文件夹。因此只用替换该文件夹便可部署。
第一次启动ngnix服务(start ngnix)即可。此后可不用重启。
后端
第一步
先关闭后端服务.lsof -i:端口号,找到后端服务的端口进程,kill掉。
第二步
将本地后端文件替换服务器中的后端文件
第三步
重启服务器后端服务
python manage.py runserver 0.0.0.0.8000
常驻服务:nohup python manage.py runserver 0.0.0.0:8000 >…/logs/out.log 2>&1 &
其中nohup就是不挂起的意思。
django数据库更新
第一步
修改了model.py文件之后
第二步
python manage.py makemigrations
python manage.py migrate
在服务器上pip install模块
需要先cd /usr/local/python3/bin
然后pip3.8 install
在服务器上删库后重新装库
python manage.py makemigrations testapp
python manage.py makemigrations testknowledge
python manage.py makemigrations testcheck
python manage.py migrate
然后再进入for_test文件夹下先把datafortest文件移动到跟manage.py同级目录,然后执行datafortest文件
linux软链接
https://blog.csdn.net/u011304078/article/details/121430785