views:

45

answers:

2

I'm having an issue with setting up a Django website which uses the Django comments framework on my server. The site runs fine when run locally (using manage.py runserver) but when pushed live I'm getting the error:

ImproperlyConfigured at /
The COMMENTS_APP setting refers to a non-existing package.

My server is an apache/mod_wsgi setup. My site contains 2 applications called weblog and weblog_comments. I've appended my site's path and it's parent directories to my django.wsgi file as per the guide located here: http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango I can comment out the COMMENTS_APP line from my settings.py and the site runs fine so I know site is on the python path correctly.

My custom comment model is called WeblogComment and extends the default Comment model. It only extends this to add methods to the model, it doesn't change Comment model fields thus It has proxy=True in it's Meta class.

Any advice would be great.

A: 

See if alternate WSGI script described at end of:

http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html

makes a difference. If it does, would be nice if can help us work out why. Still trying to get some confirmation on why so can work out if people using Django wrong, of whether Django WSGI adapter by itself is inadequate.

BTW, also just ensure that all code is readable by Apache user and that you don't have any special directories listed in your user account PYTHONPATH that aren't duplicated in WSGI script sys.path setup.

Graham Dumpleton
Graham. Using that alternate script is definately an improvement. I can get the site to load with the custom model. However it now only works sporadically. I get a 500 Internal Server Error message every now and then, other times it works fine. I checked the logs and I get the error "Target WSGI script '/path/to/site/blog/apache/django.wsgi' cannot be loaded as Python module". Any ideas of what I should check?
Groady
What is the Python traceback after that line in the log files, that will tell you what the problem is. You may have to take the issue over to the proper Django users list where the experts are. Ensure when you post there that you actually included the details of Python tracebacks etc.
Graham Dumpleton
A: 

Graham, I've got the site working now by adding the WSGIDaemonProcess and WSGIProcessGroup directives to my virtual host file as per your suggestion here: http://stackoverflow.com/questions/1553165/multiple-django-sites-with-apache-mod-wsgi.

This seems to have worked. I probably should have mentioned I'm running another Django site as well as a Wordpress blog on the same box under different domains/virtual hosts. To be quite honest, I'm not quite sure why this is now working. Maybe you have an idea?

Groady