linux之django+vue网站项目部署(uwsgi+nginx+supervisor)

该博客详细介绍了如何在Linux系统中部署Django+Vue的网站项目,包括熟悉Linux操作,配置阿里云源,安装Python3,创建虚拟环境,安装和配置数据库(Mariadb),处理静态文件,安装和配置uWSGI,使用nginx处理静态文件,通过supervisor守护进程,以及解决项目启动中遇到的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 熟悉linux操作

2. 配置阿里云的源

2.1 备份所有repo
cd /etc/yum.repos.d
mkdir repobak
mv * repobak/
2.2 下载阿里云源和epel扩展源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

3.上传****项目

4.安装python3解释器

#####   注意1: 必须先安装库环境
yum install -y gcc patch libffi-devel python-devel  zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

##### 	注意2: 配置环境变量/etc/profile,python3的变量一定要放在第一位

5.安装虚拟环境virtualenv

5.1 安装虚拟环境
pip3 install -i https://pypi.douban.com/simple virtualenv

6.安装virtualenvwrapper工具

6.1 下载并安装virtualenvwrapper
pip3 install -i https://pypi.douban.com/simple virtualenvwrapper
6.2 配置用户环境变量配置文件
vim ~/.bashrc

在最后添加以下内容:

export WORKON_HOME=~/Envs
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
export VIRTUALENVWRAPPER_PYTHON=/opt/python36/bin/python3
source /opt/python36/bin/virtualenvwrapper.sh
6.3 重载用户环境变量配置文件
source ~/.bashrc
6.4 创建****项目虚拟环境
mkvirtualenv web_pj_env

6.5 安装项目软件包
# 安装xadmin
pip install https://codeload.github.com/sshwsfc/xadmin/zip/django2 -i https://pypi.douban.com/simple/
# 安装依赖包:
pip3 install -i https://pypi.douban.com/simple -r requirements.txt

7.打包vue项目

此处是用xshell进行文件上传的;下面教程仅供参考;

linux下需要安装node.js环境(windows打包也可,linux打包也可以)
7.1 修改src目录下的settings.js配置文件
# 注意,在打包之前,最好是将src目录下面的setting.js配置文件里面的配置修改一下
# 将IP与端口改为我们部署服务器的IP和端口

export default {
    Host: "http://192.168.12.249:8000"
}

7.2 打包vue项目并上传到服务器/opt/web/web_pc/目录下
npm run build

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值