views:

35

answers:

1

Right now, any url just brings up a project default page ("welcome to django").

No matter what I put (example.com, example.com/hello, example.com/asdfjkasdf(&$(#$$#)

I'm new to django and am following a simple tutorial.

My nginx.conf has this:

location / {
                        # host and port to fastcgi server
                        fastcgi_pass 127.0.0.1:8801;
                        fastcgi_param PATH_INFO $fastcgi_script_name;
                        fastcgi_param REQUEST_METHOD $request_method;
                        fastcgi_param QUERY_STRING $query_string;
                        fastcgi_param SERVER_NAME $server_name;
                        fastcgi_param SERVER_PORT $server_port;
                        fastcgi_param SERVER_PROTOCOL $server_protocol;
                        fastcgi_param CONTENT_TYPE $content_type;
                        fastcgi_param CONTENT_LENGTH $content_length;
                        fastcgi_pass_header Authorization;
                        fastcgi_intercept_errors off;
}

My site files are stored in /var/www/firstsite/

My views.py has this:

from django.http import HttpResponse

def hello(request):
    return HttpResponse("Hello world")

And my urls.py has this:

from django.conf.urls.defaults import *
from firstsite.views import hello
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns('',
        ('^hello/$', hello),
    # Example:
    # (r'^firstsite/', include('firstsite.foo.urls')),

    # Uncomment the admin/doc line below and add 'django.contrib.admindocs'
    # to INSTALLED_APPS to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    # (r'^admin/', include(admin.site.urls)),
)

Do I need to restart the fcgi instance with each change(I wouldn't think so). I've been using: python manage.py runfcgi method="thread" host=127.0.0.1 port=8080

So yeah, how can I get urls working? Is there a way I can debug using django? For example, maybe print out the data it's receiving to make sure nginx is behaving correctly?

+1  A: 

Don't start by trying to set Django up with FastCGI. Follow the actual tutorial, and use the built-in development server. Once you've got a grip on how the basic framework works, then you can move to understanding how to deploy it.

And why would you say you wouldn't think you would have to restart the instance with each change? That is precisely what you need to do.

Daniel Roseman