Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a VM instance of Ubuntu Server 10.04, running django with mod_wsgi. It was working fine, and then after doing an /etc/init.d/apache2 reload and /etc/init.d/apache2 restart, I get nothing but Internal 500 errors. I checked the logs, and when I hit the server, nothing it output. However when the server is restarted, I get the following, which as far as I can tell is not related to my problem.

EDIT: Just realized I have a custom logging file, not in the usual place. Here is what the real log file has been catching all this time:

  [Mon Jul 19 05:40:10 2010] [info] [client 192.168.1.152] mod_wsgi (pid=1693, process='', application='192.168.1.153|'): Loading WSGI script '/srv/www/mysite.com/application/django.wsgi'.
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] mod_wsgi (pid=1693): Exception occurred processing WSGI script '/srv/www/mysite.com/application/django.wsgi'.
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] Traceback (most recent call last):
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line 241, in __call__
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     response = self.get_response(request)
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 142, in get_response
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     return self.handle_uncaught_exception(request, resolver, exc_info)
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 166, in handle_uncaught_exception
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     return debug.technical_500_response(request, *exc_info)
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/views/debug.py", line 58, in technical_500_response
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     html = reporter.get_traceback_html()
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/views/debug.py", line 137, in get_traceback_html
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     return t.render(c)
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/template/__init__.py", line 173, in render
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     return self._render(context)
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/template/__init__.py", line 167, in _render
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     return self.nodelist.render(context)
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/template/__init__.py", line 796, in render
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     bits.append(self.render_node(node, context))
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/template/debug.py", line 72, in render_node
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     result = node.render(context)
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/template/debug.py", line 89, in render
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     output = self.filter_expression.resolve(context)
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/template/__init__.py", line 579, in resolve
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     new_obj = func(obj, *arg_vals)
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/template/defaultfilters.py", line 693, in date
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     return format(value, arg)
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/utils/dateformat.py", line 281, in format
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     return df.format(format_string)
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/utils/dateformat.py", line 30, in format
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     pieces.append(force_unicode(getattr(self, piece)()))
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/utils/dateformat.py", line 187, in r
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     return self.format('D, j M Y H:i:s O')
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/utils/dateformat.py", line 30, in format
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     pieces.append(force_unicode(getattr(self, piece)()))
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/utils/encoding.py", line 66, in force_unicode
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     s = unicode(s)
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/utils/functional.py", line 206, in __unicode_cast
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     return self.__func(*self.__args, **self.__kw)
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/__init__.py", line 55, in ugettext
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     return real_ugettext(message)
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/utils/functional.py", line 55, in _curried
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs))
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/__init__.py", line 36, in delayed_loader
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     return getattr(trans, real_name)(*args, **kwargs)
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/trans_real.py", line 276, in ugettext
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     return do_translate(message, 'ugettext')
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/trans_real.py", line 266, in do_translate
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     _default = translation(settings.LANGUAGE_CODE)
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/trans_real.py", line 176, in translation
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     default_translation = _fetch(settings.LANGUAGE_CODE)
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/trans_real.py", line 159, in _fetch
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     app = import_module(appname)
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]   File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py", line 35, in import_module
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152]     __import__(name)
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] TemplateSyntaxError: Caught 

ImportError while rendering: No module named mysite.website

[Mon Jul 19 07:40:11 2010] [debug] mod_deflate.c(615): [client 192.168.1.152] Zlib: Compressed 620 to 383 : URL /admin
share|improve this question
    
What was changed recently on the server - eg why were you doing a reload/restart. Perhaps there is a misconfiguration, file permission issue, etc... –  Chris Kimpton Jul 19 '10 at 6:58
    
The only thing I changed was in my django files. I did change the urls.py file because I was seeing intermitent Internal 500 Errors that would disappear on refresh. But I tried undoing that change and it didn't help. It's also a bit unbelievable that logging is showing nothing wrong. –  Rhubarb Jul 19 '10 at 12:26
    
Just added a whole new set of log messages after realizing I had set up a non standard log file path. –  Rhubarb Jul 19 '10 at 12:49

2 Answers 2

up vote 1 down vote accepted

The only thing I changed was in my django files. I did change the urls.py file

mod_wsgi (pid=1693): Exception occurred processing WSGI script '/srv/www/mysite.com/application/django.wsgi

Go back and take a look at what you changed and then confirm the error shown in your error log above. It should be obvious. Your changes created the error. Try restoring the django file you modified... eg urls.py

share|improve this answer

In your /etc/apache2/apache2.conf file you can turn your logging up and maybe catch the error. You should find a section like this:

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

Change it to this and try and restart the server:

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel debug
share|improve this answer
    
Lots of things can make Apache go boing, I think we just need a little more info to help you on this one. –  monkee Jul 19 '10 at 6:08
    
More info now provided. –  Rhubarb Jul 19 '10 at 12:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.