Django :渲染页面,站点访问控制,管理网站,网站框架
Nginx:ip访问管理,数据传输控制
Uwsgi:处理链接Diango和Nginx的传输协议,也可以看作是处理客户端数据和Django之间的通信协议,Django原生支持
Celery:任务调度处理,用于应用异步任务处理,任务持久化等,消息中间件,django-celery原生支持
Rabbitmq:消息队列用于进程间通信,数据持久化等, 配合消息中间件使用,支持Celery
配置:Django+Nginx+Uwsgi https://uwsgi.readthedocs.io/en/latest/tutorials/Django_and_nginx.html
uwsgi.ini配置
[uwsgi]
socket=:8001
chdir=path/to/uwsgi.ini
module=djangoProjectName.wsgi:application
master=True
pidfile=/tmp/project-master.pid
vacuum=True
max-requests=5000
daemonize=/var/log/uwsgi/oj.log
启动命令:uwsgi --ini uwsgi.ini --enable-threads
Nginx配置
upstream django {
# server unix:///path/to/your/mysite/mysite.sock; # for a file socket unix .sock通信方式
server 127.0.0.1:8001; # for a web port socket (we'll use this first) web port socket通信方式,对应uwsgi.ini的socket设置
}
# configuration of the server
server {
# the port your site will be served on
listen 8000;
# the domain name it will serve for
server_name .example.com; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
location /static{
alias path/to/website/static
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
path/to/uwsgi_params; # the uwsgi_params file you installed
}
}
rabbitmq简单配置:http://docs.celeryproject.org/en/latest/getting-started/brokers/rabbitmq.html#id3
rabbitmq配合celery简单使用:http://docs.celeryproject.org/en/latest/getting-started/brokers/rabbitmq.html#id3
celery配合Django简单使用:https://www.cnblogs.com/alex3714/p/6351797.html