title: Django attribute error. 'module' object has no attribute 'rindex'
body: <p>I've just started using django, only on chapter 3 of the online book.</p>
  
  <p>I keep on getting this weird error when I try and access the site.</p>
  
  <p>AttributeError at /test/
  'module' object has no attribute 'rindex'</p>
  
  <p>my urls.py is just</p>
  
  <pre><code>from django.conf.urls.defaults import *
  from mysite import hello
  # Uncomment the next two lines to enable the admin:
  # from django.contrib import admin
  # admin.autodiscover()
  
  urlpatterns = patterns('',
        ('^test/$',hello),
  )
  </code></pre>
  
  <p>and my hello function is in mysite.
  Python path is </p>
  
  <pre><code>['/home/james/django/mysite', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/local/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/pymodules/python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.6/gtk-2.0', '/home/james/django']
  </code></pre>
  
  <p>I don't really understand whats going on here. I'm assuming I'm overlooking something stupid, because it seems so straightforward. When I do from mysite import hello in the python interpreter, it doesn't raise any errors.</p>
  
  <p>any help would  be great</p>
  
  <p>edit:
  traceback</p>
  
  <pre><code>Environment:
  
  Request Method: GET
  Request URL: http://127.0.0.1:8000/test/
  Django Version: 1.2.3
  Python Version: 2.6.6
  Installed Applications:
  ['django.contrib.auth',
   'django.co
   ntrib.contenttypes',
       'django.contrib.sessions',
       'django.contrib.sites',
       'django.contrib.messages']
      Installed Middleware:
      ('django.middleware.common.CommonMiddleware',
       'django.contrib.sessions.middleware.SessionMiddleware',
       'django.middleware.csrf.CsrfViewMiddleware',
       'django.contrib.auth.middleware.AuthenticationMiddleware',
       'django.contrib.messages.middleware.MessageMiddleware')
  
  
  Traceback:
  File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py" in get_response
    91.                         request.path_info)
  File "/usr/lib/pymodules/python2.6/django/core/urlresolvers.py" in resolve
    217.                     sub_match = pattern.resolve(new_path)
  File "/usr/lib/pymodules/python2.6/django/core/urlresolvers.py" in resolve
    123.             return self.callback, args, kwargs
  File "/usr/lib/pymodules/python2.6/django/core/urlresolvers.py" in _get_callback
    134.             mod_name, func_name = get_mod_func(self._callback_str)
  File "/usr/lib/pymodules/python2.6/django/core/urlresolvers.py" in get_mod_func
    78.         dot = callback.rindex('.')
  
  Exception Type: AttributeError at /test/
  Exception Value: 'module' object has no attribute 'rindex'
  </code></pre>
  
  <p>hello function is</p>
  
  <pre><code>from django.http import HttpResponse
  
  def hello(request):
      return HttpResponse("Hello world")
  </code></pre>