title: django @login_required decorator error
body: <p>I'm running django 1.1rc. All of my code works correctly using django's built in development server; however, when I move it into production using Apache's mod_python, I get the following error on all of my views:</p>
  
  <pre><code> Caught an exception while rendering: Reverse for '&lt;django.contrib.auth.decorators._CheckLogin
  </code></pre>
  
  <p>What might I look for that's causing this error?</p>
  
  <p><strong>Update:</strong>
  What's strange is that I can access the views account/login and also the admin site just fine. I tried removing the @login_required decorator on all of my views and it generates the same type of exception.</p>
  
  <p><strong>Update2:</strong>
  So it seems like there is a problem with any view in my custom package: booster. The django.contrib works fine. I'm serving the app at <a href="http://server_name/booster" rel="nofollow noreferrer">http://server_name/booster</a>. However, the built-in auth login view redirects to <a href="http://server_name/accounts/login" rel="nofollow noreferrer">http://server_name/accounts/login</a>. Does this give a clue to what may be wrong?</p>
  
  <p><strong>Traceback:</strong></p>
  
  <pre><code>Environment:
  
  Request Method: GET
  Request URL: http://lghbb/booster/hospitalists/
  Django Version: 1.1 rc 1
  Python Version: 2.5.4
  Installed Applications:
  ['django.contrib.auth',
   'django.contrib.contenttypes',
   'django.contrib.sessions',
   'django.contrib.sites',
   'django.contrib.admin',
   'booster.core',
   'booster.hospitalists']
  Installed Middleware:
  ('django.middleware.common.CommonMiddleware',
   'django.contrib.sessions.middleware.SessionMiddleware',
   'django.contrib.auth.middleware.AuthenticationMiddleware')
  
  
  Template error:
  In template c:\booster\templates\hospitalists\my_patients.html, error at line 23
     Caught an exception while rendering: Reverse for '&lt;django.contrib.auth.decorators._CheckLogin object at 0x05016DD0&gt;' with arguments '(7L,)' and keyword arguments '{}' not found.
     13 :                     &lt;th scope="col"&gt;Name&lt;/th&gt;
  
  
     14 :                     &lt;th scope="col"&gt;DOB&lt;/th&gt;
  
  
     15 :                     &lt;th scope="col"&gt;IC&lt;/th&gt;
  
  
     16 :                     &lt;th scope="col"&gt;Type&lt;/th&gt;
  
  
     17 :                     &lt;th scope="col"&gt;LOS&lt;/th&gt;
  
  
     18 :                     &lt;th scope="col"&gt;PCP&lt;/th&gt;
  
  
     19 :                     &lt;th scope="col"&gt;Service&lt;/th&gt;
  
  
     20 :                 &lt;/tr&gt;
  
  
     21 :             &lt;/thead&gt;
  
  
     22 :             &lt;tbody&gt;
  
  
     23 :              {% for patient in patients %} 
  
  
     24 :                 &lt;tr class="{{ patient.gender }} select"&gt;
  
  
     25 :                         &lt;td&gt;{{ patient.bed }}&lt;/td&gt;
  
  
     26 :                         &lt;td&gt;{{ patient.mr }}&lt;/td&gt;
  
  
     27 :                         &lt;td&gt;{{ patient.acct }}&lt;/td&gt;
  
  
     28 :                         &lt;td&gt;&lt;a href="{% url hospitalists.views.patient patient.id %}"&gt;{{ patient }}&lt;/a&gt;&lt;/td&gt;
  
  
     29 :                         &lt;td&gt;{{ patient.dob }}&lt;/td&gt;
  
  
     30 :                         &lt;td class="{% if patient.infections.count %}infection{% endif %}"&gt;
  
  
     31 :                             {% for infection in patient.infections.all %}
  
  
     32 :                             {{ infection.short_name }} &amp;nbsp;
  
  
     33 :                             {% endfor %}
  
  
  Traceback:
  File "C:\Python25\Lib\site-packages\django\core\handlers\base.py" in get_response
    92.                 response = callback(request, *callback_args, **callback_kwargs)
  File "C:\Python25\Lib\site-packages\django\contrib\auth\decorators.py" in __call__
    78.             return self.view_func(request, *args, **kwargs)
  File "c:/booster\hospitalists\views.py" in index
    50.   return render_to_response('hospitalists/my_patients.html', RequestContext(request, {'patients': patients, 'user' : request.user}))
  File "C:\Python25\Lib\site-packages\django\shortcuts\__init__.py" in render_to_response
    20.     return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
  File "C:\Python25\Lib\site-packages\django\template\loader.py" in render_to_string
    108.     return t.render(context_instance)
  File "C:\Python25\Lib\site-packages\django\template\__init__.py" in render
    178.         return self.nodelist.render(context)
  File "C:\Python25\Lib\site-packages\django\template\__init__.py" in render
    779.                 bits.append(self.render_node(node, context))
  File "C:\Python25\Lib\site-packages\django\template\debug.py" in render_node
    71.             result = node.render(context)
  File "C:\Python25\Lib\site-packages\django\template\loader_tags.py" in render
    97.         return compiled_parent.render(context)
  File "C:\Python25\Lib\site-packages\django\template\__init__.py" in render
    178.         return self.nodelist.render(context)
  File "C:\Python25\Lib\site-packages\django\template\__init__.py" in render
    779.                 bits.append(self.render_node(node, context))
  File "C:\Python25\Lib\site-packages\django\template\debug.py" in render_node
    71.             result = node.render(context)
  File "C:\Python25\Lib\site-packages\django\template\loader_tags.py" in render
    24.         result = self.nodelist.render(context)
  File "C:\Python25\Lib\site-packages\django\template\__init__.py" in render
    779.                 bits.append(self.render_node(node, context))
  File "C:\Python25\Lib\site-packages\django\template\debug.py" in render_node
    81.             raise wrapped
  
  Exception Type: TemplateSyntaxError at /hospitalists/
  Exception Value: Caught an exception while rendering: Reverse for '&lt;django.contrib.auth.decorators._CheckLogin object at 0x05016DD0&gt;' with arguments '(7L,)' and keyword arguments '{}' not found.
  
  Original Traceback (most recent call last):
    File "C:\Python25\Lib\site-packages\django\template\debug.py", line 71, in render_node
      result = node.render(context)
    File "C:\Python25\Lib\site-packages\django\template\defaulttags.py", line 155, in render
      nodelist.append(node.render(context))
    File "C:\Python25\Lib\site-packages\django\template\defaulttags.py", line 382, in render
      raise e
  NoReverseMatch: Reverse for '&lt;django.contrib.auth.decorators._CheckLogin object at 0x05016DD0&gt;' with arguments '(7L,)' and keyword arguments '{}' not found.
  </code></pre>
  
  <p>Thanks for your help,
  Pete</p>