Django + Nginx + Uwsgi + Celery + Rabbitmq 做一个高速响的应网站架构
Django :渲染頁面,站點(diǎn)訪問控制,管理網(wǎng)站,網(wǎng)站框架
Nginx:ip訪問管理,數(shù)據(jù)傳輸控制
Uwsgi:處理鏈接Diango和Nginx的傳輸協(xié)議,也可以看作是處理客戶端數(shù)據(jù)和Django之間的通信協(xié)議,Django原生支持
Celery:任務(wù)調(diào)度處理,用于應(yīng)用異步任務(wù)處理,任務(wù)持久化等,消息中間件,django-celery原生支持
Rabbitmq:消息隊列用于進(jìn)程間通信,數(shù)據(jù)持久化等, 配合消息中間件使用,支持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通信方式,對應(yīng)uwsgi.ini的socket設(shè)置
}
# 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
轉(zhuǎn)載于:https://www.cnblogs.com/akfheaven/p/9228741.html
總結(jié)
以上是生活随笔為你收集整理的Django + Nginx + Uwsgi + Celery + Rabbitmq 做一个高速响的应网站架构的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 最短Hamilton路径-状压dp解法
- 下一篇: 我国法定报告的传染病分为几类?包括哪些传