【问题标题】:Configuring Gunicorn: No application module specified配置 Gunicorn:未指定应用程序模块
【发布时间】:2015-01-01 02:28:04
【问题描述】:

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

我不断收到 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,但是当我这样做时,它会显示“workers failed to boot”。如何设置应用模块?

【问题讨论】:

    标签: python django nginx gunicorn digital-ocean


    【解决方案1】:

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

    gunicorn -b 127.0.0.1:8001 your_project_name.wsgi:application

    您需要从项目文件夹(manage.py 文件所在的位置)运行它

    【讨论】:

    • 当我这样做时,现在我得到服务器错误 (500)
    • 这意味着您的代码中存在错误。检查您的日志。
    猜你喜欢
    • 2020-08-29
    • 1970-01-01
    • 2015-02-21
    • 1970-01-01
    • 2018-03-10
    • 2018-01-27
    • 1970-01-01
    • 2018-07-08
    • 1970-01-01
    相关资源
    最近更新 更多