views:

65

answers:

2

Hello, I keep getting this error at random times and whenever I touch the django.wsgi file, it gets fixed only to happen again after a few hours. I'm lost as to what to do. my middleware_classes is as follows:

MIDDLEWARE_CLASSES = ( 'django.middleware.cache.UpdateCacheMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.csrf.CsrfResponseMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.middleware.facebookConnectMiddleware.FacebookConnectMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.cache.FetchFromCacheMiddleware', 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', ).

The error always occurs in the facebook middleware when i do an "if request.session" statement. Thanks

A: 

Are you using Apache? If so, you should probably restart httpd after you modify the mod_wsgi file.

sudo apachectl -k restart
sudo apache2ctl -k restart
sudo /etc/init.d/httpd restart

... or similar should work. If you're still seeing the problem, try pasting in the full error message.

godswearhats
Whether a full Apache restart is required is dependent on how you are using mod_wsgi. If using daemon mode there are ways of restarting application code without restarting the whole of Apache. See 'http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode'.
Graham Dumpleton
True enough. I'm diagnosing the symptoms a bit here: typically when I see a problem recur it's because it's fixed in one Apache thread but not in all of them ... hence the restart idea. It's worth a try :-)
godswearhats
i restarted apache and that seemed to do the trick. thank you both for your input :-)
kingsley
nope.. the problem occurred again. entering the url without an ending slash gives the error and it only gets fixed temporarily when i touch django.wsgi..what to do..
kingsley
What does your wsgi file look like? and your urls.py?
godswearhats
A: 

Try the alternate WSGI script file documented at end of:

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

Report back to mod_wsgi list if that helps as we are trying still to uncover what if any problems that alternate WSGI script is solving, so can work out whether a real problem or whether users aren't using Django properly.

Graham Dumpleton