tags:

views:

36

answers:

1

I notice that the official recommended book "The Definitive Guide to Django" was written based on mod_python, for both editions.

However, I think most beginners would follow what most people use: mod_wsgi.

I followed their first tutorials, that is, display current time

I have the mod_wsgi and everything setup correctly. But I am still getting the default page regardless how I access to http://domain/time/

Is there any book that is written for mod_wsgi, or did t setup the environment incorrectly?

I know I can begin without using apache, but it would be a headache in the future to deploy apache again...


EDIT

I added the wsgi script and inclued that in the views.py. It seems to work. Is it the right way???

So what is the purpose of having a separate wsgi script anyway? I know the official guide said that create a folder name such as /apache/ and create django.wsgi...

+1  A: 

You don't need a full rewrite of the Django book for mod_wsgi. The ony thing that is different is the apache.conf and the script inside your cgi-bin directory (both aren't directly related to Django, so all the Django parts will apply for both).

But you might probably find it useful to read the general usage/configuration instructions for mod_wsgi, and probably the special notes about django too. If you have some troubles (e.g. some kind of error message in your apache.log) then you might look at the ConfigurationIssues page too.

So what is the purpose of having a separate wsgi script anyway?

Nearly all Python web applications are based on the WSGI specification, which allows your application to be used with CGI, FastCGI, mod_python, mod_wsgi, etc. So, you might have more than one of those scripts - one for each technology for example.

Another thing is, that you can also control a lot of configuration settings inside this script (e.g. forking of additional python processes for increased performance, path to additional python modules or different versions of existing modules) which are normally set by the server administrator (and not the application developer). Thats probably also the main reason why such scripts aren't included directly in the applications.

And the third thing is, that you might have several such wsgi scripts which are deploying the same application with different settings. For example, you might have your application deployed several times for different users, or with different database settings (e.g. production and testing).

tux21b
Thank you for the answer. I think I really had the wrong direction, and should concentrate with the django instead of mod_wsig. That should be my future concern. The built-in dev server is probably the best ATM.
JohnWong
Yes, you are definitely right. Good luck for your current project!
tux21b