Admin 500 Error

263 views
Skip to first unread message

Bret W

unread,
Sep 8, 2008, 7:59:45 PM9/8/08
to Django users
I can only get this error to show up if DEBUG is set to False, but it
happens consistently when debugging is off.

MOD_PYTHON ERROR

ProcessId: 10229
Interpreter: 'webfaction.com'

ServerName: 'webfaction.com'
DocumentRoot: '/home/user/webapps/mysite/django_static'

URI: '/admin/'
Location: '/'
Directory: None
Filename: '/home/user/webapps/mysite/django_static/admin'
PathInfo: '/'

Phase: 'PythonHandler'
Handler: 'django.core.handlers.modpython'

Traceback (most recent call last):

File "/home/user/lib/python2.5/mod_python/importer.py", line 1537,
in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

File "/home/user/lib/python2.5/mod_python/importer.py", line 1229,
in _process_target
result = _execute_target(config, req, object, arg)

File "/home/user/lib/python2.5/mod_python/importer.py", line 1128,
in _execute_target
result = object(arg)

File "/home/user/lib/python2.5/django/core/handlers/modpython.py",
line 222, in handler
return ModPythonHandler()(req)

File "/home/user/lib/python2.5/django/core/handlers/modpython.py",
line 195, in __call__
response = self.get_response(request)

File "/home/user/lib/python2.5/django/core/handlers/base.py", line
128, in get_response
return self.handle_uncaught_exception(request, resolver, exc_info)

File "/home/user/lib/python2.5/django/core/handlers/base.py", line
160, in handle_uncaught_exception
return callback(request, **param_dict)

File "/home/user/lib/python2.5/django/views/defaults.py", line 88,
in server_error
t = loader.get_template(template_name) # You need to create a
500.html template.

File "/home/user/webapps/mysite/django_projects/bretwcom/
__init__.py", line 11, in cached_get_template
template_cache[template_name] = t =
original_get_template(template_name)

File "/home/user/webapps/mysite/django_projects/bretwcom/
__init__.py", line 11, in cached_get_template
template_cache[template_name] = t =
original_get_template(template_name)

File "/home/user/lib/python2.5/django/template/loader.py", line 80,
in get_template
source, origin = find_template_source(template_name)

File "/home/user/lib/python2.5/django/template/loader.py", line 73,
in find_template_source
raise TemplateDoesNotExist, name

TemplateDoesNotExist: 500.html

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Nothing shows up in the Apache log, and since
django.views.defaults.server_error passes an empty Context object, the
only way I can see what's happening is to have mod_python throw the
error.

Does anyone know why this is happening? Any leads would be
appreciated.

Thanks.

Malcolm Tredinnick

unread,
Sep 8, 2008, 8:57:19 PM9/8/08
to django...@googlegroups.com

On Mon, 2008-09-08 at 16:59 -0700, Bret W wrote:
> I can only get this error to show up if DEBUG is set to False,

Because that's when Django is not going to use the debugging page, but
rather display your 500 template. When DEBUG=True, you will see the nice
debugging page, but that's for development purposes, not for general
production use (although it can be useful to have it on for brief
periods in production to diagnose problems).

> but it
> happens consistently when debugging is off.

Which means that your site is consistently throwing some kind of
internal error.

You are responsible for providing a 500.html template that will be
returned to your users when an internal, uncaught error is thrown. That
still won't provide you with any extra debugging information, unless you
enable mailing to the admins (which will then send 500 errors to you).
You could set DEBUG=True for a while if you can trigger the problem
yourself and then use the debug screen to diagnose the problem, but if
it is only occurring sporadically, that won't be as productive.

Regards,
Malcolm

Bret W

unread,
Sep 8, 2008, 9:31:04 PM9/8/08
to Django users
On Sep 8, 8:57 pm, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote:
> Because that's when Django is not going to use the debugging page, but
> rather display your 500 template. When DEBUG=True, you will see the nice
> debugging page, but that's for development purposes, not for general
> production use (although it can be useful to have it on for brief
> periods in production to diagnose problems).

I probably wasn't very clear.

When DEBUG = True, the admin loads just fine.

My problem is that I can't get the admin to fail when debugging is
turned on, so I can never see the helpful Django debugging page.

Further, I don't believe any objects are passed to the 500 template,
so I can't display errors using my template. That's why I removed my
500.html template -- so that mod_python would throw the (nasty
looking) error.

I'm trying to figure out a) why the admin is throwing errors only when
DEBUG=False and b) how I can display the source of the error.

Thanks,
Bret

Bret W

unread,
Sep 8, 2008, 9:37:15 PM9/8/08
to Django users
Sorry to post yet again.

Two things I forgot to mention -- this error only happens on the admin
home page and all of my INSTALLED_APPS should be valid and seem to be
functioning correctly.

Karen Tracey

unread,
Sep 8, 2008, 9:43:32 PM9/8/08
to django...@googlegroups.com
On Mon, Sep 8, 2008 at 9:31 PM, Bret W <bretw...@gmail.com> wrote:

When DEBUG = True, the admin loads just fine.

My problem is that I can't get the admin to fail when debugging is
turned on, so I can never see the helpful Django debugging page.

Further, I don't believe any objects are passed to the 500 template,
so I can't display errors using my template. That's why I removed my
500.html template -- so that mod_python would throw the (nasty
looking) error.

I'm trying to figure out a) why the admin is throwing errors only when
DEBUG=False and b) how I can display the source of the error.


To get the traceback mailed to you, include your userid in the ADMINS list in settings.py and set the various EMAIL_ settings to specify a valid mail server and source email id (see http://docs.djangoproject.com/en/dev/ref/settings/#email-host).

I am aware of one problem reported with the admin home page and debug set to False.  It is:

http://code.djangoproject.com/ticket/8110

It's a shot in the dark, but you could try applying the 8110.diff posted on that ticket and seeing if it fixes the problem.  I have not been able to recreate this problem myself.

Karen

Bret W

unread,
Sep 9, 2008, 7:08:41 PM9/9/08
to Django users


On Sep 8, 9:43 pm, "Karen Tracey" <kmtra...@gmail.com> wrote:

> I am aware of one problem reported with the admin home page and debug set to
> False.  It is:
>
> http://code.djangoproject.com/ticket/8110

That was it. Thanks!
Reply all
Reply to author
Forward
0 new messages