Django 部署 uwsgi + nginx + supervisor
2016-10-23 08:44
357 查看
Django 部署 uwsgi + nginx + supervisor
https://hacpai.com/article/1460607620615?p=1&m=0zonghua • 6 个月前 • 浏览 1.7K • 回帖 15
Python Django uwsgi NGINX
更新依赖
pip install uwsgi
编辑配置文件
uwsgi.ini
[uwsgi] # Django-related settings chdir = /home/zonghua/Documents/test_project module = test_project.wsgi:application env = DJANGO_SETTINGS_MODULE=test_project.settings_production home = /home/zonghua/Documents/test_project/venv reload-mercy = 10 user = zonghua uid = zonghua pcre-jit thunder-lock enable-threads master = True threads = 2 processes = 4 socket = 127.0.0.1:8001 chmod-socket = 664 vacuum = true
执行命令
uwsgi --ini uwsgi.ini
运行情况
[uwsgi](https://hacpai.com/tag/uwsgi) getting INI configuration from /home/zonghua/Documents/test_project/uwsgi.ini *** Starting uWSGI 2.0.12 (64bit) on [Tue Apr 5 13:59:02 2016] *** compiled with version: 5.2.1 20151010 on 04 April 2016 01:12:07 os: Linux-4.2.0-34-generic #39-Ubuntu SMP Thu Mar 10 22:13:01 UTC 2016 nodename: x machine: x86_64 clock source: unix pcre jit enabled detected number of CPU cores: 4 current working directory: /home/zonghua/Documents/test_project detected binary path: /home/zonghua/Documents/test_project/venv/bin/uwsgi chdir() to /home/zonghua/Documents/test_project your processes number limit is 11829 your memory page size is 4096 bytes detected max file descriptor number: 1024 lock engine: pthread robust mutexes thunder lock: enabled uwsgi socket 0 bound to TCP address 127.0.0.1:8001 fd 3 Python version: 2.7.10 (default, Oct 14 2015, 16:09:02) [GCC 5.2.1 20151010] Set PythonHome to /home/zonghua/Documents/test_project/venv Python main interpreter initialized at 0x93b180 python threads support enabled your server socket listen backlog is limited to 100 connections your mercy for graceful operations on workers is 60 seconds mapped 415360 bytes (405 KB) for 8 cores *** Operational MODE: preforking+threaded *** WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x93b180 pid: 2781 (default app) *** uWSGI is running in multiple interpreter mode *** spawned uWSGI master process (pid: 2781) spawned uWSGI worker 1 (pid: 2784, cores: 2) spawned uWSGI worker 2 (pid: 2785, cores: 2) spawned uWSGI worker 3 (pid: 2787, cores: 2) spawned uWSGI worker 4 (pid: 2789, cores: 2)
nginx 配置 文件
/etc/nginx/site-avaiable/test
server { listen 80; charset utf-8; client_max_body_size 75M; location /media { alias /path/to/project/media; } location /static { alias /path/to/project/static; } location / { uwsgi_pass 127.0.0.1:8001; include uwsgi_params; } }
supervisor 配置文件
/etc/supervisor/supervisor.conf
[program:test] directory= /home/zonghua/Documents/test_project command = /home/zonghua/Documents/test_project/venv/bin/uwsgi --ini /home/zonghua/Documents/test_project/uwsgi.ini user = zonghua autostart = true autorestart = true stopsignal = QUIT redirect_stderr = true loglevel = error stdout_logfile = /home/zonghua/Documents/test_project/logs/uwsgi_out.log stderr_logfile = /home/zonghua/Documents/test_project/logs/uwsgi_err.log logfile_maxbytes = 1M
热加载需要指定一个 pidfile,待添加。
相关文章推荐
- 基于ubuntu使用nginx+uwsgi部署django,并使用supervisor管理(不坑人)
- uwsgi+django+nginx+supervisor部署web应用(python)
- 初探django-使用uwsgi+supervisor+nginx来部署服务
- Ubuntu+django+Nginx+uwsgi+supervisor部署
- ubuntu+uwsgi+nginx+django+supervisor部署
- nginx + uwsgi + Django 应用部署
- 生产环境使用Nginx+uwsgi部署Django
- django+nginx+uwsgi+service部署web应用
- 解决nginx+uwsgi部署Django的所有问题(小结)
- django+uwsgi+nginx部署
- 生产环境使用Nginx+uwsgi部署Django
- flask+uwsgi+supervisor+nginx在局域网服务器上部署实践
- 【Django】Django web项目部署(Nginx+uwsgi)
- nginx+uwsgi部署django应用
- 利用uWSGI和Nginx部署Django
- Nginx+uwsgi部署django应用
- django+uwsgi+nginx 部署生产环境
- CentOS7部署Django,nginx,uwsgi,redis
- 【转】Nginx+uWSGI 部署 Django 应用
- 通过uwsgi和nginx部署django项目