“Django/docs/3.2.x/howto/deployment/wsgi/gunicorn”的版本间差异
来自菜鸟教程
Django/docs/3.2.x/howto/deployment/wsgi/gunicorn
(Page commit) |
小 (Page commit) |
||
第1行: | 第1行: | ||
− | {{DISPLAYTITLE:如何在 Gunicorn 中使用 Django}} | + | {{DISPLAYTITLE:如何在 Gunicorn 中使用 Django — Django 文档}} |
<div id="how-to-use-django-with-gunicorn" class="section"> | <div id="how-to-use-django-with-gunicorn" class="section"> | ||
第43行: | 第43行: | ||
</div> | </div> | ||
− | [[Category: | + | [[Category:Django 3.2.x 文档]] |
2021年10月31日 (日) 04:17的最新版本
如何在 Gunicorn 中使用 Django
Gunicorn ('Green Unicorn') 是一个用于 UNIX 的纯 Python WSGI 服务器。 它没有依赖项,可以使用 pip
安装。
在 Gunicorn 中将 Django 作为通用 WSGI 应用程序运行
安装 Gunicorn 后,可以使用 gunicorn
命令启动 Gunicorn 服务器进程。 对 gunicorn 的最简单调用是传递包含名为 application
的 WSGI 应用程序对象的模块的位置,对于典型的 Django 项目,它如下所示:
gunicorn myproject.wsgi
这将启动一个进程运行一个线程监听 127.0.0.1:8000
。 它要求你的项目在 Python 路径上; 确保这一点的最简单方法是从与 manage.py
文件相同的目录中运行此命令。
有关其他提示,请参阅 Gunicorn 的 部署文档 。