Django 部署 uwsgi + nginx + supervisor
Django 部署 uwsgi + nginx + supervisor
https://hacpai.com/article/1460607620615?p=1&m=0
更新依赖
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,待添加。
Django 部署 uwsgi + nginx + supervisor的更多相关文章
- [py]django上线部署-uwsgi+nginx+py3/django1.10
https://github.com/lannyMa/django-uwsgi-nginx.git 单机调试启动-确保项目代码没问题 - 克隆代码进入项目 git clone https://gith ...
- django 本地项目部署uwsgi 以及云服务器部署 uwsgi+Nginx+Docker+MySQL主从
一 .django 本地项目部署uwsgi 1 本地部署项目 uwsgi安装测试 通过uwsgi 进行简单部署 安装uwsgi命令:pip install uwsgi -i http://pypi.d ...
- django自带wsgi server vs 部署uwsgi+nginx后的性能对比
一.下面先交代一下测试云主机 cpu: root@alexknight:/tmp/webbench-1.5# cat /proc/cpuinfo |grep model model : model n ...
- ubuntu 部署Django项目+uwsgi+Nginx
1.部署框架 Nginx负责静态资源请求,并且把无法处理的请求转发至uwsgi处理 2.安装并配置Nginx 2.1安装 apt-get install nginx (如果安装失败请先升级apt-ge ...
- Django 部署到Nginx
在网上搜了很多篇Django+uwsgi+Nginx的部署文章,忙了一下午头昏脑胀,最终完成了部署.部署文章流程讲解都很好,但在细节上或许缺乏一些注意力,导致我多篇文章来回切换在字里行间寻找蛛丝马迹. ...
- [Django笔记] uwsgi + nginx 配置
django 和 nginx 通过 uwsgi 来处理请求,类似于 nginx + php-fpm + php 安装nginx 略 安装配置uwsgi pip install uwsgi 回想php- ...
- 项目部署(ubuntu+uwsgi+nginx+supervisor+django)
一.在开发机上的准备工作 1. 确认项目没有bug. 2.设置`ALLOW_HOST`为你的域名,以及ip地址. 4.设置`DEBUG=False`,避免如果你的网站产生错误,而将错误信息暴漏给用户. ...
- 「Linux+Django」Django+CentOs7+uwsgi+nginx部署网站记录
转自:http://www.usday.cn/blog/51 部署前的准备: 1. 在本地可以运行的django项目 2. 一台云服务器,这里选用Centos系统 开始部署: 首先在本地导出项目需要的 ...
- Django部署--uwsgi配置--nginx服务器配置
uwsgi.ini文件 [uwsgi] #使用nginx连接时使用,Django程序所在服务器地址 socket=127.0.0.1:8000 #直接做web服务器使用,Django程序所在服务器地址 ...
随机推荐
- 帕雷托最优(Pareto optimality)、帕雷托效率(Pareto efficiency)
帕雷托最优(英语:Pareto optimality),或帕雷托最适,也称为帕雷托效率(英语:Pareto efficiency),是经济学中的重要概念,并且在博弈论.工程学和社会科学中有着广泛的应用 ...
- factor graph model
主实验 文慧:用户,商品,评分,review,ranking. 数据集:数据规模,论文源代码
- 1104关于优化mysql服务器几个参数和思路
转自http://www.cnblogs.com/AloneSword/p/3207697.html 按照从大到小,从主要到次要的形式,分析 mysql 性能优化点,达到最终优化的效果. 利用 min ...
- Retrofit 2.1 入门
Retrofit 2.1入门 , map); try { Response<String>body=call.execute(); System.out. ...
- [转]Mybatis出现:无效的列类型: 1111 错误
原文地址:http://www.cnblogs.com/sdjnzqr/p/4304874.html 在使用Mybatis时,不同的xml配置文件,有的会提示:无效的列类型: 1111 比如这个sql ...
- 树分治 poj 1741
n k n个节点的一棵树 k是距离 求树上有几对点距离<=k; #include<stdio.h> #include<string.h> #include<algo ...
- Jquery.min.js 下载
Jquery 下载:http://www.jq22.com/jquery-info122
- 一起学HTML基础-利用CSS和JavaScript制作一个切换图片的网页
由于个人原因,不详细写步骤 思路: 一.布局 二.制作图片区和按钮区的div及颜色.边框.背景属性等 三.用PS将四张图片剪切到同一个尺寸,重叠放置在图片切换区,透明度设置为0 四.点击对应按钮时,将 ...
- 一起学HTML基础-CSS样式表-基本概念、分类、选择器
一.基本概念: CSS (Cascading Style Sheets)层叠样式表,是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言. ...
- 【POJ 3177】Redundant Paths(边双连通分量)
求出每个边双连通分量缩点后的度,度为1的点即叶子节点.原图加上(leaf+1)/2条边即可变成双连通图. #include <cstdio> #include <cstring> ...