Can't see wsgi response in browser

nttaylor

I've been going through a few tutorials on how to deploy a Python wsgi app using gunicorn and nginx. I've followed the steps and the app seems to run, but when I try to visit the relevant port in a browser, the browser just loads forever and never resolves to anything.

I'm using Ubuntu 14.04, Python 2.7, and gunicorn 19.1. Mostly I've been using this tutorial: https://www.digitalocean.com/community/tutorials/how-to-deploy-python-wsgi-apps-using-gunicorn-http-server-behind-nginx

which has instructions on how to set up the most basic wsgi app as a proof of concept. Basically you put this code into a file called "wsgi.py"

def application(env, start_response):
    start_response('200 OK', [('Content-Type', 'text/html')])
    return ["Hello!"]

So I did that. Then, from the directory containing the wsgi.py file, I ran: "$ gunicorn wsgi --bind 0.0.0.0:8080 --log-file=-"

The process starts and seems to run fine. That should be it, right? But when I go to http://[my-IP-address]:8080, the browser just stalls forever.

Any ideas on what I am doing wrong? At first I thought maybe I had to configure something with nginx, but now I don't think nginx needs to be involved just to prove that I can run this wsgi app. Any help would be appreciated.

nttaylor

Thanks to Daniel and Cory for their suggestions, but I figured it out. This happened because of my unfamiliarity with the syntax of the nginx config file. In there was a line blocking all traffic from a range of ports that included the one where my app was running.

A breakthrough came when someone suggested that I try hitting the URL with curl (which I always forget about) instead of with a browser. When I did this from the same machine that was serving the app it worked fine, because the configuration did allow traffic to that port from localhost. My takeaway from this: Don't forget about curl!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related