1.安装python
https://www.cnblogs.com/changtao/articles/10539287.html
2.安装mysql数据库
https://www.cnblogs.com/changtao/articles/10539299.html
3.安装nginx
# 切换到 /usr/local/src cd /usr/local/src # 下载nginx 安装包 wget http://nginx.org/download/nginx-1.6.2.tar.gz # 解压 tar zxvf nginx-1.6.2.tar.gz # 切换到 nginx-1.6.2 cd nginx-1.6.2 # 检查配置 ./configure --prefix=/usr/local/nginx # 编译并且编译安装 make && make install # 建立service 服务 vim /lib/systemd/system/nginx.service -------------------------------------------- [Unit] Description=nginx After=network.target [Service] Type=forking ExecStart=/usr/local/nginx/sbin/nginx ExecReload=/usr/local/nginx/sbin/nginx -s reload ExecStop=/usr/local/nginx/sbin/nginx -s quit PrivateTmp=true [Install] WantedBy=multi-user.target ---------------------------------------------- # 启动nginx systemctl start nginx.service # 设置开机启动 systemctl enable nginx.service # 修改配置文件 vim /usr/local/nginx/config/nginx.conf ---------------------------------------------- http 里加 upstream movie { server 127.0.0.1:5000; } server 里加 location { proxy_pass http://movie; } 注意: nginx 默认的启动配置文件是 /usr/local/nginx/sbin/nginx nginx启动时如何指定配置文件?????????????
4.在linux下载pipenv
pip inseall pipenv pipenv install 初始化虚拟环境 pipenv install -r 依赖的文件名 下载依赖包
5.在lrzsz 便于linux 传输文件
yum install lrzsz -
y (linux安装文件拖动软件,可以方便的在windows linux之间传输文件)
lrzsz工具提供了俩命令, rz(接收资源) sz(发送资源)
6.在开发环境中导出项目的依赖模块
pipenv freeze > 文件 // pip freeze > ***.txt
7.下载 gunicorn
pip install gunicorn # -w 绑定线程数 # -b 绑定ip+port # server 启动文件 # app flask的核心对象 gunicorn -w 4 -b 127.0.0.1:9000 server:app
8.注意:nginx 配置文件的路径,使用gunicorn启动项目时,server:app server不能和APP重名!!!!