title: django url reverse not working for named urls (re-edited) found the cause but now stuck!
body: <p>See bottom for latest break throughs:
  I'm running django SVN 15632</p>
  
  <p><code>Tried viewHallo in module core.views. Error was: 'module' object has no attribute 'viewHallo'</code></p>
  
  <p>is the error I am getting after trying <code>reverse('home')</code> or <code>reverse('admin:index')</code>.</p>
  
  <p>this is my projects urls.py:</p>
  
  <pre><code>from django.conf.urls.defaults import patterns, include, url
  from django.contrib.staticfiles.views import serve as serveStatic
  
  from django.contrib import admin
  admin.autodiscover()
  
  urlpatterns = patterns('',
      (r'^admin/',   include(admin.site.urls)),
      (r'^dbrowse/', include('dbrowse.urls')),
      (r'^static/',  serveStatic),
  url (r'^$',    'core.views.viewHallo',name='home'),
  )
  </code></pre>
  
  <p>this is core\views.py</p>
  
  <pre><code>from django.shortcuts import render_to_response
  from django.template.context import RequestContext
  import site
  
  def viewHallo (request):
      pass
      return render_to_response ('core.html',
                                 {'site':site,
                                  'title':'i am the hallo view',
                                  'content':'Hallo World!',},
                                  context_instance=RequestContext(request))
  </code></pre>
  
  <p>using the shell or even a script <code>reverse('home')</code> and <code>reverse('admin:index')</code> just isn't working.</p>
  
  <p>However in my templates <code>{% url home %}</code> and {% url admin:index %} work just fine...</p>
  
  <p>in my app <code>core</code> i have a file called <code>site.py</code> i use this file to store stuff about the site so i dont have to rely on the database. long story short it contains <code>reverse('home')</code>. Now this is only important because no matter where <code>reverse()</code> is excecuted script or shell or template, the stack trace always includes the line from <code>site.py</code>.</p>
  
  <p>why on earth is django excecuting <code>site.py</code>? and even if it does why is it stumbling over the <code>reverse('home')</code>?. Interstingly if I comment out the line from <code>site.py</code> then <code>reverse()</code> starts working properly.</p>
  
  <p>whats going on?? here is <code>core\site.py</code></p>
  
  <pre><code>from django.contrib.sites.models import Site
  from django.conf import settings
  from django.core.urlresolvers import reverse
  
  site = Site.objects.get(pk=settings.SITE_ID)
  
  NAME = site.name
  SLOGAN = 'it\'s a deal!'
  COPY_HOLDER = 'My Name'
  
  
  #(link_title, 'link_address', ['permission'])
  MAIN_MENU = [['home', reverse('home'), 'core.view_tender'],
               ['admin', reverse('admin:index'), 'is_staff']]
  </code></pre>
  
  <hr>
  
  <p>EDIT: I have isolated the line in django's source code that's throwing the error:
  line 91 in <code>django/core/urlresolvers.py</code></p>
  
  <p><code>91: lookup_view = getattr(import_module(mod_name), func_name)</code>
  it triggers django <code>importlib</code> which in turn imports <code>site.py</code>.</p>