views:

39

answers:

1

Hi,

I have a problem with my django application. On django developer server its work perfect, but when I switch it to apache something strange happening. Lets check the code:

class Criteria(models.Model):
    district = models.ManyToManyField(District, verbose_name=u"Województwo", blank=True)
    respondents = models.ManyToManyField(User, verbose_name=u"Respondenci")

    def getData(self):
        # return self.district.all() - good
        return self.respondents.all() # error

When I set in settings.py debug variable to true (DEBUG=True) nothing bad happens. But when I switch it to false (DEBUG=False) I get an error when I call that method.

MOD_PYTHON ERROR

ProcessId:      19463
Interpreter:    'www.panelbadawczy.pl'

ServerName:     'www.panelbadawczy.pl'
DocumentRoot:   '/htdocs'

URI:            '/edytuj-badanie,3/ustal-kryteria/'
Location:       None
Directory:      None
Filename:       '/htdocs'
PathInfo:       '/edytuj-badanie,3/ustal-kryteria/'

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

Traceback (most recent call last):

  File "/usr/lib/python2.6/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch
    default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.6/site-packages/mod_python/importer.py", line 1229, in _process_target
    result = _execute_target(config, req, object, arg)

  File "/usr/lib/python2.6/site-packages/mod_python/importer.py", line 1128, in _execute_target
    result = object(arg)

  File "/usr/lib/python2.6/site-packages/django/core/handlers/modpython.py", line 228, in handler
    return ModPythonHandler()(req)

  File "/usr/lib/python2.6/site-packages/django/core/handlers/modpython.py", line 201, in __call__
    response = self.get_response(request)

  File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 134, in get_response
    return self.handle_uncaught_exception(request, resolver, exc_info)

  File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 166, in handle_uncaught_exception
    return callback(request, **param_dict)

  File "/usr/lib/python2.6/site-packages/django/views/defaults.py", line 24, in server_error
    return http.HttpResponseServerError(t.render(Context({})))

  File "/usr/lib/python2.6/site-packages/django/template/__init__.py", line 178, in render
    return self.nodelist.render(context)

  File "/usr/lib/python2.6/site-packages/django/template/__init__.py", line 779, in render
    bits.append(self.render_node(node, context))

  File "/usr/lib/python2.6/site-packages/django/template/__init__.py", line 792, in render_node
    return node.render(context)

  File "/usr/lib/python2.6/site-packages/django/template/loader_tags.py", line 97, in render
    return compiled_parent.render(context)

  File "/usr/lib/python2.6/site-packages/django/template/__init__.py", line 178, in render
    return self.nodelist.render(context)

  File "/usr/lib/python2.6/site-packages/django/template/__init__.py", line 779, in render
    bits.append(self.render_node(node, context))

  File "/usr/lib/python2.6/site-packages/django/template/__init__.py", line 792, in render_node
    return node.render(context)

  File "/usr/lib/python2.6/site-packages/django/template/loader_tags.py", line 24, in render
    result = self.nodelist.render(context)

  File "/usr/lib/python2.6/site-packages/django/template/__init__.py", line 779, in render
    bits.append(self.render_node(node, context))

  File "/usr/lib/python2.6/site-packages/django/template/__init__.py", line 792, in render_node
    return node.render(context)

  File "/usr/lib/python2.6/site-packages/django/template/__init__.py", line 930, in render
    resolved_vars = [var.resolve(context) for var in self.vars_to_resolve]

  File "/usr/lib/python2.6/site-packages/django/template/__init__.py", line 687, in resolve
    value = self._resolve_lookup(context)

  File "/usr/lib/python2.6/site-packages/django/template/__init__.py", line 740, in _resolve_lookup
    raise VariableDoesNotExist("Failed lookup for key [%s] in %r", (bit, current)) # missing attribute

VariableDoesNotExist: Failed lookup for key [user] in u"[{'block': <Block Node: loginBox. Contents: [<Text Node: '\r\n                '>, <django.template.InclusionNode object at 0x91a002c>, <Text Node: '\r\n\t\t\t'>]>}, {}]"

Any ideas ?

A: 

I would look into this block node "loginBox" and the required parameter 'user' if I were you.

Klaas van Schelven