400 028 6601

建站动态

根据您的个性需求进行定制 先人一步 抢占小程序红利时代

Django+Uwsgi+Nginx实现生产环境部署的方式-创新互联

这篇文章主要讲解了Django+Uwsgi+Nginx实现生产环境部署的方式,内容清晰明了,对此有兴趣的小伙伴可以学习一下,相信大家阅读完之后会有帮助。

创新互联-专业网站定制、快速模板网站建设、高性价比赣州网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式赣州网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖赣州地区。费用合理售后完善,十载实体公司更值得信赖。

如何在生产上部署Django

Django的部署可以有很多方式,采用nginx+uwsgi的方式是其中比较常见的一种方式。

uwsgi介绍

uWSGI是一个Web服务器,它实现了WSGI协议、uwsgi、http等协议。Nginx中HttpUwsgiModule的作用是与uWSGI服务器进行交换。

要注意 WSGI / uwsgi / uWSGI 这三个概念的区分。

uwsgi性能非常高

Django+Uwsgi+Nginx实现生产环境部署的方式

uWSGI的主要特点如下

总而言之uwgi是个部署用的好东东,正如uWSGI作者所吹嘘的:

If you are searching for a simple wsgi-only server, uWSGI is not for you, but if you are building a real (production-ready) app that need to be rock-solid, fast and easy to distribute/optimize for various load-average, you will pathetically and morbidly fall in love (we hope) with uWSGI.

Uwsgi 安装使用

# Install the latest stable release:
pip install uwsgi
# ... or if you want to install the latest LTS (long term support) release,
pip install https://projects.unbit.it/downloads/uwsgi-lts.tar.gz

基本测试

Create a file called test.py:

# test.py
def application(env, start_response):
  start_response('200 OK', [('Content-Type','text/html')])
  return [b"Hello World"] # python3
  #return ["Hello World"] # python2

新闻名称:Django+Uwsgi+Nginx实现生产环境部署的方式-创新互联
当前路径:http://mbwzsj.com/article/picsj.html

其他资讯

让你的专属顾问为你服务