配置服务器
- 选择一台服务器,安装相关包和依赖
# 配置静态IP
# 安装Python及相关依赖
yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel #yum -y install db4-devel libpcap-devel xz-devel #yum install libffi-devel -y
yum install epel-release -y
yum install gcc -y
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz
tar -xvJf Python-3.7.2.tar.xz
cd Python-3.7.2
./configure --prefix=/usr/local/python3
make && make install
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
# 安装pipenv、cookiecutter、cookiecutter-django
pip3 install pipenv
ln -s /usr/local/python3/bin/pipenv /usr/bin/pipenv # pipenv无法识别的时候大多是没有创建pipenv的链接
pipenv --python 3.7 # 进入指定文件夹下,创建虚拟环境
pip3 install cookiecutter
git clone https://github.com/pydanny/cookiecutter-django.git
mkdir project
cd project
/usr/local/python3/bin/cookiecutter cookiecutter-django # 然后就是一系列的参数填写
# 配置数据库
mysql
redis
配置Pycharm远程开发
1、远程链接服务器
2、配置远程虚拟环境
这样,我们在Pycharm中就可以和远程同步操作文件和代码了!
评论区