未指定应用程序模块

未指定应用程序模块

本文介绍了配置Gunicorn:未指定应用程序模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用NGINX和gunicorn部署django项目。我不断收到502错误网关。在过去的几天里,我一直在不停地努力,似乎无法部署它。我已经看过3篇关于Digital Ocean的教程,但是显然它们是不正确的。

I'm trying to deploy a django project with NGINX and gunicorn. I keep getting 502 Bad Gateway. I've been working nonstop on this for the past few days and I can't seem to get this deployed. I've gone through 3 tutorials on Digital Ocean, but they aren't correct, obviously.

我一直收到502错误的网关,或者如果我尝试使用manage.py runserver,则会收到400错误的请求。

I keep getting 502 bad gateway, or if I try to use manage.py runserver, I get 400 bad request.

我认为我的问题出在金枪鱼上。当我输入gunicorn -config时,它会显示

I think my problem is with gunicorn. When I enter gunicorn -config, it says

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

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

Every bit of documentation I can find says to simply type gunicorn wsgi:application, but when I do, it says "workers failed to boot." How do I set an application module?

推荐答案

假设您已将nginx代理代理到端口8001,则需要执行以下操作:

Assuming you have nginx proxying to port 8001, you want to do this:

gunicorn -b 127.0.0.1:8001 your_project_name.wsgi:application

gunicorn -b 127.0.0.1:8001 your_project_name.wsgi:application

您需要从项目文件夹中运行该文件(manage.py文件位于)

You need to run that from your project folder (where the manage.py file is)

这篇关于配置Gunicorn:未指定应用程序模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 12:43