Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gunicorn will not bind to my application

I have made a django web app using the default localhost, however I am trying to set it up on a server so that I can configure a postgre database and continue on without having to redo the database later on.

I am hosting the site though a digital ocean ubuntu 14 droplet. When I created the droplet I selected that it already come preconfigured for django. It uses nginx and gunicorn to host the site.

When I first created the instance of the server, a basic django app was configured to work on the given IP. And it did.

I tried cloning my project into the same directory as that project assuming it would live on the python path ('/home/project') and configured the nginx to serve up 127.0.0.1:8000 per some of the documentation I found.

I believe the issue lies in when I try to bind gunicorn. I get the following error with this input.

gunicorn -b 127.0.0.1:8000 GenericRestaurantSystem/wsgi.py:application

ImportError: Failed to find application, did you mean 'program/wsgi:application'?

I am not 100% sure, but it seems as though gunicorn is not serving up anything (or not even on) at this point.

Any suggestions as to binding this application successfully?

like image 512
9er Avatar asked Nov 13 '14 15:11

9er


2 Answers

Well that's not how you refer to the WSGI file with gunicorn. See the docs:

The module name can be a full dotted path. The variable name refers to a WSGI callable that should be found in the specified module.

So if your wsgi.py file is in GenericRestaurantSystem/wsgi.py, your command should be

gunicorn -b 127.0.0.1:8000 GenericRestaurantSystem.wsgi:application
like image 185
Daniel Roseman Avatar answered Sep 19 '22 13:09

Daniel Roseman


I guess it should be

gunicorn GenericRestaurantSystem.wsgi:application
like image 22
sb9 Avatar answered Sep 18 '22 13:09

sb9