Gunicorn (“Green Unicorn”)是一款适用于UNIX的纯Python WSGI服务器。它没有依赖项,可以使用 pip 。
通过运行安装gunicorn python -m pip install gunicorn 。有关更多详细信息,请参阅 gunicorn documentation 。
安装Gunicorn后,一个 gunicorn 可以使用命令启动Gunicorn服务器进程。对Gunicorn的最简单调用是传递一个模块的位置,该模块包含一个名为 application ,这对于一个典型的Django项目来说应该是这样的:
gunicorn myproject.wsgi
这将启动一个进程,运行一个线程侦听 127.0.0.1:8000 . 它要求您的项目在python路径上;确保这一点的最简单方法是从与您的 manage.py 文件。
见Gunicorn deployment documentation 其他提示。
5月 28, 2025