centos7 部署django
centos7 部署django
1.拉取git代码到code用户下
2.进入到项目project目录下
3.创建虚拟目录
python3 -m venv 虚拟环境名称
4.激活虚拟环境
~/project/虚拟环境名称/bin/activate
5.构建开发环境
python setup.py develop
# 这里构建的过程中,可能会出现如下问题:
## 问题一:
`error: package directory 'find_namespace' does not exist`
### 解决方案:
#### 执行命令, 升级下setuptools
pip install --upgrade pip setuptools
## 问题二:
mysql_config --version
/bin/sh: mysql_config not found
mariadb_config --version
/bin/sh: mariadb_config not found
mysql_config --libs
/bin/sh: mysql_config: command not found
error: mysql_config not found
### 解决方案:
yum install mysql-devel
#### 若是mariadb则执行下面的命令,具体需要对应响应的版本
yum install mariadb-devel
## 问题三:
unable to execute 'gcc': not such file or directory
error: Setup script exited with error: command 'gcc' failed with exit status 1
#### 安装下python3的库
yum install python3-devel
# 继续构建
python setup.py develop
6.退出虚拟环境
deactivate