What does this set of django errors mean?

0

Issue

My Apache2 log is spitting out these errors on my Ubuntu 10.04 server. When I hit the server I get Internal 500 Errors and the log has this:

[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

Solution

Your PYTHONPATH may not contain your project directory, or your DJANGO_SETTINGS_MODULE may not contain ‘mysite.website’, at least from apache’s point of view. Whatever user apache runs as for your website needs to have that set up for it, like in its .profile. Or if you’re using mod_python, they need to be set up in the .htaccess or apache’s httpd.conf. Or if you’re using mod_wsgi, it needs to be in the wsgi setup file — passenger_wsgi.py or the like — whatever apache’s module will be looking for.

Answered By – eruciform

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More