目录
1. 发布源码到 GitHub
本地源码发布前的初始化配置
pass
本地源码发布到 GitHub
git init
git add .
# git status
git commit -m "项目初始化"
git branch -M main
git remote add origin https://github.com/xxx.git
git push -u origin main
2. 配置云主机-Django项目部署到阿里云-Centos
发布之前,要修改配置信息:
改哪些呢?
修改 settings 【Debug,Alloweb_host,DB】
python 运行环境依赖
2.1. MySQL 的安装
# 1. 查看系统是否安装mysql
rpm -qa | grep mysql
# 2. 安装wget工具
yum -y install wget
# 3. 使用wget下载依赖包列表并使用yum安装
wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
# 安装 mysql:
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server
# 安装提示报错!
The GPG keys listed for the "MySQL 5.7 Community Server" repository are
already installed but they are not correct for this package.
Check that the correct key URLs are configured for this repository.
# 原因:官方 MySQL 存储库的 GPG 密钥已过期,无法安装或更新 MySQL 包。
# 解决办法:执行如下命令:
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
# 重新执行
yum -y install mysql-community-server
# 4. 查看mysql运行状态
查看服务状态:systemctl status mysqld.service
启动服务:systemctl start mysqld.service
设置服务自启动:systemctl enable mysqld.service
查看服务是否自启动:systemctl is-enable mysqld.service
# 5. 通过端口确认mysql运行
netstat -ntlp | grep mysql
# 6. 使用初始密码登陆,修改密码
grep "password" /var/log/mysqld.log
alter user 'root'@'localhost' IDENTIFIED by '123.com';
# 7. 远程管理
# 配置远程连接的权限
update user set host='%' where host='localhost' and user='root';
# 确认防火墙的状态
systemctl status firewalld.service
2.2 Redis数据库安装
2.2.1 下载并安装Redis
# 新建redis文件夹
cd /usr
mkdir redis
cd redis
# 下载
wget http://download.redis.io/releases/redis-4.0.6.tar.gz
# 解压
tar -zxvf redis-4.0.6.tar.gz
# 安装gcc依赖
yum install gcc
# 进入目录
cd redis-4.0.6
# 进行编译
make
# 进入目录运行
cd src
#执行make install
make install
# 运行redis
redis-server
2.2.2 配置Redis
2.2.2.1 以后台进程的方式启动Redis
# 新建目录并复制redis配置文件
mkdir