title: django URL mapping?
body: <p>Newbie to django and python.  Trying to get some example calendar code up and running but having problems with URL mapping.  When I try to run the admin page (or any page), I get:  </p>
  
  <pre><code>ViewDoesNotExist at /
  
  Tried main in module cal. Error was: 'module' object has no attribute 'main'
  
  Request Method:     GET
  Request URL:    http://127.0.0.1:8000/
  Django Version:     1.3.1
  Exception Type:     ViewDoesNotExist
  </code></pre>
  
  <p>and here are my url patterns:</p>
  
  <pre><code>(r"^(\d+)/$", "main"),
  (r"", "main"),
  url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
  url(r'^admin/', include(admin.site.urls)),
  </code></pre>
  
  <p>I am confused though, because it appears to me that the function "main" does exist in views.py, as shown below.  Any help is greatly appreciated:</p>
  
  <pre><code>import time
  from django.contrib.auth.decorators import login_required
  from django.http import HttpResponseRedirect, HttpResponse
  from django.shortcuts import get_object_or_404, render_to_response
  
  from dbe.cal.models import *
  
  mnames = "January February March April May June July August September October November December"
  mnames = mnames.split()
  
  
  @login_required
  def main(request, year=None):
  """Main listing, years and months; three years per page."""
  # prev / next years
  if year: year = int(year)
  else:    year = time.localtime()[0]
  
  nowy, nowm = time.localtime()[:2]
  lst = []
  
  # create a list of months for each year, indicating ones that contain entries and current
  for y in [year, year+1, year+2]:
      mlst = []
      for n, month in enumerate(mnames):
          entry = current = False   # are there entry(s) for this month; current month?
          entries = Entry.objects.filter(date__year=y, date__month=n+1)
  
          if entries:
              entry = True
          if y == nowy and n+1 == nowm:
              current = True
          mlst.append(dict(n=n+1, name=month, entry=entry, current=current))
      lst.append((y, mlst))
  
  return render_to_response("cal/main.html", dict(years=lst, user=request.user, year=year,
                                                 reminders=reminders(request)))
  </code></pre>