日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > Nginx >内容正文

Nginx

Django + Nginx + Uwsgi + Celery + Rabbitmq 做一个高速响的应网站架构

發(fā)布時(shí)間:2025/4/14 Nginx 66 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Django + Nginx + Uwsgi + Celery + Rabbitmq 做一个高速响的应网站架构 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

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:消息隊(duì)列用于進(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

啟動(dòng)命令: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通信方式,對(duì)應(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簡(jiǎn)單配置:http://docs.celeryproject.org/en/latest/getting-started/brokers/rabbitmq.html#id3

rabbitmq配合celery簡(jiǎn)單使用:http://docs.celeryproject.org/en/latest/getting-started/brokers/rabbitmq.html#id3

celery配合Django簡(jiǎn)單使用:https://www.cnblogs.com/alex3714/p/6351797.html

轉(zhuǎn)載于:https://www.cnblogs.com/akfheaven/p/9228741.html

總結(jié)

以上是生活随笔為你收集整理的Django + Nginx + Uwsgi + Celery + Rabbitmq 做一个高速响的应网站架构的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。