1.安装依赖包
2.关闭调试模式
app.debug = False
3.源码编译安装 redis
4.修改mysql数据库连接,导入数据
5.开启多个端口后台运行
6.配置Nginx反向代理
1. jwplayer播放器插件
2. 视频限速限IP访问
3. flv、mp4视频格式支持
4. Nginx点播实现
nginx配置文件
worker_processes 4; events { worker_connections 262140; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; limit_conn_zone $binary_remote_addr zone=addr:5m; upstream movie { server 127.0.0.1:5001; server 127.0.0.1:5002; server 127.0.0.1:5003; server 127.0.0.1:5004; } server { listen 80; server_name localhost; location / { root html; index index.html index.htm; proxy_pass http://movie; } location ~ \.flv$ { flv; limit_conn addr 4; limit_rate 1024k; rewrite ^/static/uploads/(.+?).flv$ /movie_project/app/static/uploads/$1.flv permanent; } location ~ \.mp4$ { mp4; limit_conn addr 4; limit_rate 1024k; rewrite ^/static/uploads/(.+?).mp4$ /movie_project/app/static/uploads/$1.mp4 permanent; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
pipfreeze > req.txt pip install -r req.txt
vi manage.py from flask_script import Manager manage = Manager(app)
nohup python manage.py runserver -h 127.0.0.1 -p 5001 & nohup python manage.py runserver -h 127.0.0.1 -p 5002 & nohup python manage.py runserver -h 127.0.0.1 -p 5003 & nohup python manage.py runserver -h 127.0.0.1 -p 5004 &