React+Django问题
2020-03-16 本文已影响0人
M_派森
一、前言
在使用React+Django前后端分离写了个记账平台,Mysql使用了8.0版本,坑踩的头疼,主要有以下几个:
1、跨域
2、Mysql密码
3、Django启动报错
二、解决
1、先看下Django启动报错问题
(1)关于数据库

运行指令可解决
pip3 install cryptography -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
(2)关于ssl

这个有点操作,需要重新编译安装python,按如下步骤:
1、sudo yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel gcc gcc-c++ openssl-devel
2、进入解压python包下修改两个文件(Setup&Setup.dist)
vim Setup =>

vim Setup.dist =>

3、重新编译安装python
./configure --with-ssl --prefix=/usr/local/python3
sudo make
sudo make install
4、重新创建软连接
rm -rf /usr/bin/python3
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3