Software Installation
install git
install mysql
install redis
install python
Install the virtual environment
install uwsgi
install nginx
step
The request URL sent by the front end, the request sent to 8000 is captured and forwarded by nginx
deployment steps
# 本地收集static dist 上传
python manage.py collectstatic
# 拉项目
https://gitee.com/yqmc/t_api.git
# 切换(生成)虚拟环境
workon t_env
# 安装模块
pip3 install -r requirement.txt -i https://pypi.douban.com/simple
pip3 install uwsgi -i https://pypi.douban.com/simple
# uwsgi配置(配置在后面) 在项目根路径
vim t_api.xml
# nginx配置
cp /usr/local/nginx/conf/nginx.conf /home/back.conf
vim /usr/local/nginx/conf/nginx.conf
t_api.xml
<uwsgi>
<socket>127.0.0.1:8888</socket>
<chdir>/home/t_api</chdir>
<module>t_api.wsgi</module>
<processes>4</processes>
<daemonize>uwsgi.log</daemonize>
</uwsgi>
nginx.conf
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
server {
listen 80;
server_name 127.0.0.1;
charset utf-8;
location / {
root /home/dist;
index index.html;
try_files $uri $uri/ /index.html;
}
}
server {
listen 8000;
server_name 127.0.0.1;
charset utf-8;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:8888;
uwsgi_param UWSGI_SCRIPT luffy_api.wsgi;
uwsgi_param UWSGI_CHDIR /home/project/luffy_api/;
}
location /static {
alias /home/static;
}
}
}
start up
nginx
uwsgi -x t_api.xml
to kill
pkill -9 -f nginx
pkill -9 -f uwsgi
filter
ps -aux |grep nginx
ps -aux |grep uwsgi