I am working on a Django system with a Mongo backend, my first time experimenting with this setup. It has a fairly standard nginx-hands-off-to-Apache-for-python server setup. This all seems to work for a more standard Django-MySQL app on the same server.
For my Django-Mongo app, when I use 'python manage.py shell', I get:
from django.test.client import Client
client = Client()
response = client.get('/')
response.status_code
200
response.content
'<html>\n <head>\n <link href="/static/blog.css" rel="stylesheet" type="text/css">\n <title>Worldmaker</title>\n </head>\n <body>\n <ul>\n <li><a href="sourcedoc/create/">New Sourcedoc</a></li>\n <li><a href="sourcedoc/list/">All Sourcedocs</a></li>\n <li><a href="noun/create/">New Noun</a></li>\n <li><a href="noun/list/">All Nouns</a></li>\n </ul>\n <h1>Worldmaker</h1>\n \n\n </body>\n</html>\n\n'
However, when I browse to http://www.mydomain.com/gogoworld/, I get an nginx 504 page:
504 Gateway Time-out nginx/1.4.1
My /etc/nginx/sites-enabled/vhost includes this:
location /gogoworld/ {
proxy_pass http://127.0.0.1:84;
include /etc/nginx/proxy.conf;
}
My /etc/apache2/httpd.conf includes this:
<Directory "/home/rosshartshorn/htdocs/gogoworld">
WSGIScriptAlias /gogoworld /home/rosshartshorn/htdocs/gogoworld/wsgi.py
WSGIPythonPath /home/rosshartshorn/htdocs/ordinarymysqlapp:/home/rosshartshorn/htdocs/worldmaker:/home/rosshartshorn/htdocs/gogoworld
My urls.py
from django.conf.urls import patterns, include, url
from sourcedocs import views
urlpatterns = patterns('',
url(r'^$', views.index),
)
My confusion is to what the difference is between the use of django.text.client, and pinging the site with my web browser. I had thought it was the same thing, but since one returns a response and the other doesn't, I am obviously incorrect. Is the difference only at the apache and/or nginx level, or are there parts of the django machinery that are different as well? Any ideas on where to look to see why this works in the django shell but not via the browser?
Edit: here's what's in my sites-available/rosshartshorn:
Listen 84
<IfModule mod_ssl.c>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
<VirtualHost *:84>
ServerName www.rosshartshorn.net
ServerAlias rosshartshorn.net
DocumentRoot /home/rosshartshorn/htdocs
<Directory /home/rosshartshorn/htdocs>
AllowOverride All
allow from all
</Directory>
</VirtualHost>