Django学习
简明 Django
开始第一个django项目
DJ 基本设置
test django1.4 on centos6
quick to start django app
django app login system
boot django with uwsgi tool
nginx proxy django site from uwsgi
Python django 环境
python pyenv multi env
python install 2.7 on centos 6
windows support python 2.7
python3/pip3 on centos 6
Python 3 pip3 SSL未配置
本文档使用 MrDoc 发布
-
+
首页
nginx proxy django site from uwsgi
# deploy dj uwsgi from production --- ## deploy nginx $ yum install nginx nginx-devel pcre pcre-devel ```bash user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } http { log_format access '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log access; sendfile on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; include /etc/nginx/conf.d/vhost/*.conf; } ``` ## deploy django $ pip install Django==1.11.7 ```bash ├── dj_uwsgi │ ├── __init__.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── djuw_test │ ├── admin.py │ ├── apps.py │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ └── views.py └── manage.py ``` ## deploy uwsgi ```python $ pip install uwsgi ``` ```bash [uwsgi] # 项目目录 chdir=/opt/OpsManage/ # 指定项目的application module=OpsManage.wsgi:application # 指定sock的文件路径 socket=/opt/OpsManage/script/uwsgi.sock # wsig file=/opt/OpsManage/OpsManage/wsgi.py # 进程个数 workers=5 pidfile=/opt/OpsManage/script/uwsgi.pid # 指定IP端口 http=10.81.235.164:8000 # 指定静态文件 static-map=/static=/opt/OpsManage/OpsManage/static/ # 启动uwsgi的用户名和用户组 uid=root gid=root # 启用主进程 master=true # 自动移除unix Socket和pid文件当服务停止的时候 vacuum=true # 序列化接受的内容,如果可能的话 thunder-lock=true # 启用线程 enable-threads=true # 设置自中断时间 harakiri=30 # 设置缓冲 post-buffering=4096 # 设置日志目录 daemonize=/opt/OpsManage/logs/uwsgi.log ``` start uwsgi $ uwsgi -i uwsgi.ini $ ps -ef |grep uwsgi ```bash root 537 1 0 Jun27 ? 00:00:01 uwsgi -i uwsgi.ini root 552 537 0 Jun27 ? 00:00:00 uwsgi -i uwsgi.ini root 553 537 0 Jun27 ? 00:00:00 uwsgi -i uwsgi.ini root 554 537 0 Jun27 ? 00:00:01 uwsgi -i uwsgi.ini root 555 537 0 Jun27 ? 00:00:00 uwsgi -i uwsgi.ini root 556 537 0 Jun27 ? 00:00:00 uwsgi -i uwsgi.ini root 557 537 0 Jun27 ? 00:00:00 uwsgi -i uwsgi.ini root 1331 552 0 Jun27 ? 00:00:00 [uwsgi] <defunct> root 1361 553 0 Jun27 ? 00:00:00 [uwsgi] <defunct> root 1392 556 0 Jun27 ? 00:00:00 [uwsgi] <defunct> root 1414 555 0 Jun27 ? 00:00:00 [uwsgi] <defunct> root 1481 554 0 Jun27 ? 00:00:00 [uwsgi] <defunct> ``` Done.
Bobby
2021年12月21日 23:44
分享文档
收藏文档
阅读
351
上一篇
下一篇
微信扫一扫
复制链接
手机扫一扫进行分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码