BTW, the logged error details will end up in the Apache error log only.

Graham

On 6 April 2011 21:05, Graham Dumpleton <[email protected]> wrote:
> The problem with Django is that there are certain circumstances where
> it will hide the actual error message and traceback and replace it
> will a higher level exception, but with the traceback then being where
> that higher level exception was raised. This is one such case.
>
> To try and find the real location of the exception add the following
> to your WSGI script file.
>
> import traceback
> import sys
>
> def dump_exception(callable):
>    def wrapper(*args, **kwargs):
>        try:
>            return callable(*args, **kwargs)
>        except:
>            traceback.print_exception(*sys.exc_info())
>    return wrapper
>
> import django.core.urlresolvers
>
> urlresolvers.get_callable = dump_exception(urlresolvers.get_callable)
>
> This wraps the call which is doing the lookup and will dump out the
> error message it raises before the traceback gets thrown away.
>
> Please provide the resulting traceback as am quite curious to see it
> and what it shows.
>
> Graham
>
> On 6 April 2011 19:01, Max <[email protected]> wrote:
>> Thank you for the quick response!
>>
>> I've set PYTHONVERBOSE as explained.
>> The traceback I can offer though is the Django traceback.
>> The Apache error log says nothing in warn level and even in debug mode
>> it shows no python errors.
>>
>> Here is the Django traceback:
>>
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/core/handlers/base.py" in get_response
>>  111.                         response = callback(request,
>> *callback_args, **callback_kwargs)
>> File "/Users/max/Documents/project/Website-Code/current/project/
>> views.py" in startpage
>>  51.     return render_to_response(u'start.html',
>> {'next_events':next_events}, context_instance=RequestContext(request))
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/shortcuts/__init__.py" in render_to_response
>>  20.     return HttpResponse(loader.render_to_string(*args,
>> **kwargs), **httpresponse_kwargs)
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/loader.py" in render_to_string
>>  188.         return t.render(context_instance)
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/base.py" in render
>>  123.             return self._render(context)
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/base.py" in _render
>>  117.         return self.nodelist.render(context)
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/base.py" in render
>>  744.                 bits.append(self.render_node(node, context))
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/debug.py" in render_node
>>  73.             result = node.render(context)
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/loader_tags.py" in render
>>  127.         return compiled_parent._render(context)
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/base.py" in _render
>>  117.         return self.nodelist.render(context)
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/base.py" in render
>>  744.                 bits.append(self.render_node(node, context))
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/debug.py" in render_node
>>  73.             result = node.render(context)
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/loader_tags.py" in render
>>  64.             result = block.nodelist.render(context)
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/base.py" in render
>>  744.                 bits.append(self.render_node(node, context))
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/debug.py" in render_node
>>  73.             result = node.render(context)
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/defaulttags.py" in render
>>  311.             return self.nodelist_true.render(context)
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/base.py" in render
>>  744.                 bits.append(self.render_node(node, context))
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/debug.py" in render_node
>>  73.             result = node.render(context)
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/defaulttags.py" in render
>>  227.                 nodelist.append(node.render(context))
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/defaulttags.py" in render
>>  313.             return self.nodelist_false.render(context)
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/base.py" in render
>>  744.                 bits.append(self.render_node(node, context))
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/debug.py" in render_node
>>  73.             result = node.render(context)
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/debug.py" in render
>>  90.             output = self.filter_expression.resolve(context)
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/base.py" in resolve
>>  510.                 obj = self.var.resolve(context)
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/base.py" in resolve
>>  653.             value = self._resolve_lookup(context)
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/template/base.py" in _resolve_lookup
>>  698.                             current = current()
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/utils/functional.py" in _curried
>>  55.         return _curried_func(*(args+moreargs), **dict(kwargs,
>> **morekwargs))
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/db/models/base.py" in get_absolute_url
>>  887.     return settings.ABSOLUTE_URL_OVERRIDES.get('%s.%s' %
>> (opts.app_label, opts.module_name), func)(self, *args, **kwargs)
>> File "/Users/max/Documents/project/Website-Code/current/project/Models/
>> Events/models.py" in get_absolute_url
>>  221.             return self.eventinfo.get_absolute_url()
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/utils/functional.py" in _curried
>>  55.         return _curried_func(*(args+moreargs), **dict(kwargs,
>> **morekwargs))
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/db/models/base.py" in get_absolute_url
>>  887.     return settings.ABSOLUTE_URL_OVERRIDES.get('%s.%s' %
>> (opts.app_label, opts.module_name), func)(self, *args, **kwargs)
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/db/models/__init__.py" in inner
>>  35.         return reverse(bits[0], None, *bits[1:3])
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/core/urlresolvers.py" in reverse
>>  391.             *args, **kwargs)))
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/core/urlresolvers.py" in reverse
>>  312.         possibilities = self.reverse_dict.getlist(lookup_view)
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/core/urlresolvers.py" in _get_reverse_dict
>>  229.             self._populate()
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/core/urlresolvers.py" in _populate
>>  220.                 lookups.appendlist(pattern.callback, (bits,
>> p_pattern))
>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
>> site-packages/django/core/urlresolvers.py" in _get_callback
>>  167.             raise ViewDoesNotExist("Could not import %s. Error
>> was: %s" % (mod_name, str(e)))
>>
>> Exception Type: TemplateSyntaxError at /
>> Exception Value: Caught ViewDoesNotExist while rendering: Could not
>> import project.Models.Events.views. Error was: No module named _thread
>>
>>
>> On 5 Apr., 00:07, Graham Dumpleton <[email protected]> wrote:
>>> Can you provide the traceback?
>>>
>>> You can also try adding:
>>>
>>>   PYTHONVERBOSE=1
>>>   export PYTHONVERBOSE
>>>
>>> into the 'envvars' file in same directory as httpd and stop/start Apache.
>>>
>>> This will cause Python to log stuff about all the imports it is doing,
>>> where it is looking etc. It may help to clarify at least where it is
>>> looking for stuff.
>>>
>>> Graham
>>>
>>> On 5 April 2011 05:09, Max <[email protected]> wrote:
>>>
>>>
>>>
>>> > Hi!
>>>
>>> > I'm new to this group and that is my reason for joining:
>>>
>>> > The latest Apple Security Update installed the latest Apache release
>>> > 2.2.17
>>>
>>> > I use this server for the development of a Django based website. After
>>> > the update the localhost didn't load the Django site anymore.
>>> > The Apache update motivated me to install all the new software
>>> > available for the complete project, before figuring out and fixing all
>>> > the failure messages. (Intended to be a heroic step, now it seems
>>> > silly.)
>>>
>>> > Software related to this website project and versions (before and
>>> > now):
>>> > Apache 2.2.13       to 2.2.17
>>> > Django 1.1.1          to 1.3
>>> > mod_wsgi 2.3        to 3.3
>>> > MySQL 5.1.31       to 5.5.10
>>> > mySQLdb 1.2.3.b1 to 1.2.3
>>> > Python 2.5            to 2.7.1
>>> > Mac OS X 10.5.8
>>>
>>> > It was a long way to get there. There were difficulties with
>>> > architectures etc.
>>>
>>> > Now I have Django running and it nicely displays:
>>>
>>> > Caught ViewDoesNotExist while rendering: Could not import
>>> > myproject.Models.amodel.views. Error was: No module named _thread
>>>
>>> > From the Django traceback I can't figure out which script wants to
>>> > import module _thread.
>>> > Neither my project nor Django imports it.
>>>
>>> > From python.org I found out that _thread is the module name in Python
>>> > version 3.x for module thread (in Python 2.x).
>>>
>>> > I was checking parts of the mod_wsgi source code but couldn't find a
>>> > hint.
>>> > I switched software versions... Python to 2.6.6, mod_wsgi back to 2.3,
>>> > Django back to 1.1.1 and 1.2.5.
>>> > The error remained.
>>> > I never had Python 3.x installed, so no other software was installed
>>> > against this version.
>>>
>>> > I hope someone in this group can give me a hint where to look; Or even
>>> > better, someone knows which script wants to import a non-existent
>>> > module.
>>>
>>> > Thanks for help,
>>> >  Max
>>>
>>> > --
>>> > You received this message because you are subscribed to the Google Groups 
>>> > "modwsgi" group.
>>> > To post to this group, send email to [email protected].
>>> > To unsubscribe from this group, send email to 
>>> > [email protected].
>>> > For more options, visit this group 
>>> > athttp://groups.google.com/group/modwsgi?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "modwsgi" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/modwsgi?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to