Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring Gunicorn: No application module specified

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.

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

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.

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?

like image 311
Cameron Sima Avatar asked Nov 05 '14 01:11

Cameron Sima


People also ask

Is Gunicorn an application server?

Gunicorn is an application server. Gunicorn implements the Web Server Gateway Interface (WSGI), which is a standard interface between web server software and web applications.

Do I need nginx with Gunicorn?

Technically, you don't really need Nginx. BUT it's the Internet: your server will receive plenty of malformed HTTP requests which are made by bots and vulnerability scanner scripts. Now, your Gunicorn process will be busy parsing and dealing with these requests instead of serving genuine clients.


1 Answers

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

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

like image 144
Isaac Ray Avatar answered Oct 02 '22 16:10

Isaac Ray