配置 Gunicorn:未指定应用程序模块

问题描述 投票:0回答:1

我正在尝试使用 NGINX 和 Gunicorn 部署 django 项目。我不断收到 502 Bad Gateway。过去几天我一直在不停地工作,但似乎无法部署它。我已经阅读了 3 个关于 Digital Ocean 的教程,但显然它们都不正确。

我不断收到 502 bad gateway,或者如果我尝试使用 manage.py runserver,我会收到 400 bad request。

我认为我的问题是gunicorn。当我输入gunicorn -config时,它说

usage: gunicorn [OPTIONS] [APP_MODULE] gunicorn: error: No application module specified.

我能找到的所有文档都说只需输入gunicorn wsgi:application,但当我这样做时,它会说“工作人员无法启动”。如何设置应用模块?

python django nginx gunicorn digital-ocean
1个回答
22
投票

假设你有 nginx 代理到端口 8001,你想这样做:

gunicorn -b 127.0.0.1:8001 your_project_name.wsgi:application

您需要从项目文件夹(其中存在

manage.py
文件)运行该程序。

© www.soinside.com 2019 - 2024. All rights reserved.