title: Django import error in views - no module named 'x'
body: <p>I keep getting an error that there's no such module.  </p>
  
  <p>The project name is gmblnew, and I have two subfolders- <code>core</code> and <code>gmblnew</code> - the app I'm working on is core.  </p>
  
  <p>My <strong>urls.py</strong> file is</p>
  
  <pre><code>from django.conf.urls import *
  
  # Uncomment the next two lines to enable the admin:
  from django.contrib import admin
  admin.autodiscover()
  
  urlpatterns = patterns('',
      # Examples:
      # url(r'^$', 'gmblnew.views.home', name='home'),
      # url(r'^gmblnew/', include('gmblnew.foo.urls')),
  
      url(r'^league/', include('core.views.league')),
  
      # Uncomment the admin/doc line below to enable admin documentation:
      url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
  
      # Uncomment the next line to enable the admin:
      url(r'^admin/', include(admin.site.urls)),
  )
  </code></pre>
  
  <p>This seems to be fine. The <strong>views.py</strong> file is: </p>
  
  <pre><code>from django.http import HttpResponse
  
  def league(request):
      from core.models import Division
      response = HttpResponse()
      response['mimetype'] = 'text/plain'
      response.write("&lt;HTML&gt;&lt;&gt;BODY&gt;\n")
      response.write("&lt; TABLE BORDER=1&gt;&lt;CAPTION&gt;League List&lt;/CAPTION&gt;&lt;TR&gt;\n")
      all_leagues = Division.objects.all()
      for league in all_leagues:
          response.write("&lt;TR&gt;\n")
          response.write("&lt;TD&gt; %s" % league)
          response.write("&lt;/TD&gt;\n")
      response.write("&lt;/BODY&gt;&lt;/HTML&gt;")
      return response
  </code></pre>
  
  <p>Traceback:</p>
  
  <pre><code>File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
    103.                     resolver_match = resolver.resolve(request.path_info)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve
    319.             for pattern in self.url_patterns:
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/urlresolvers.py" in url_patterns
    347.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/urlresolvers.py" in urlconf_module
    342.             self._urlconf_module = import_module(self.urlconf_name)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/importlib.py" in import_module
    35.     __import__(name)
  File "/Users/chris/Dropbox/Django/gmblnew/gmblnew/urls.py" in &lt;module&gt;
    12.   url(r'^league/', include('core.views.league')),
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/conf/urls/__init__.py" in include
    25.         urlconf_module = import_module(urlconf_module)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/importlib.py" in import_module
    35.     __import__(name)
  
  Exception Type: ImportError at /admin/
  Exception Value: No module named league
  </code></pre>
  
  <p>I've tried a number of variants on the <code>url(r'^league/', include('core.views.league')),</code> line, including <code>gmblnew.core.views.league</code>, <code>views.league</code>, <code>views.view_league</code>, etc.  I'm obviously missing something super simple on the structure of that line.  </p>