导出本地的 pip 列表

  1. pip freeze > req.txt

clone 项目到服务器,在对应 python 环境下安装项目的 pip 包

  1. pip install -r req.txt

关联项目文件:

ln -s /home/unlock_channel/unlock_channel/conf/product/nginx_unlock_api.conf unlock_api.conf

检测文件语法是否正确:

  • nginx -tc /etc/nginx/nginx.conf

柔和重启 nginx :
systemctl reload nginx.service

安装 mysqlclient 时报错解决:


For MacOS 最快的临时解决方法:

  1. export PATH=$PATH:/usr/local/mysql/bin

For CentOS

  1. yum install -y python-devel mysql-devel

For Ubuntu

  1. sudo apt-get install libmysqlclient-dev
  2. updatedb
  3. locate mysql_config

CentOS 安装 nginx:

  1. sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
  2. sudo yum install -y nginx
  3. # 启动
  4. sudo systemctl start nginx.service
  5. # 开机运行
  6. sudo systemctl enable nginx.service