For Django 1.3.1, where is the source code that makes it possible to do a from django.conf.urls import patterns ?
In the Django 1.3.1 source code for the django.conf.urls package, __init__.py is empty, so there is no code or __all__ variable. The code for the patterns() function appears to be in defaults.py which does have an __all__ variable.
How does Python end up including a pattern() function in the django.conf.urls package?
I figured out my problem:
I discovered I was wrong about thinking I was successfully running
from django.conf.urls import patternin Django 1.3.1. The code was actually
from django.conf.urls.defaults import patternThere are two different Django tutorials:
from django.conf.urls import patternfrom django.conf.urls.defaults import patternI opened Django ticket 17770 for this, and it was closed as a duplicate of ticket 16932. Ticket 16933 was opened and fixed to remedy the confusion of the different versions of documentation/tutorials. However, it wasn’t apparent to me. I added a screenshot to 16933 showing how to see which version of the docs you are reading (and to select a different version).

I was confused because I thought I was using
from django.conf.urls import...as the tutorial states, and I thought that code was working. But in fact I was using the
urls.pycode that gets created withdjango-admin.py startproject, and this code is correctly usingfrom django.conf.urls.defaults import...for Django 1.3.1. That worked.
My confusion surfaced in tutorial 4, when I copied the
polls/urls.pycode from the tutorial for the dev version. That code isfrom django.conf.urls import...and it causes:jdi, thanks for your help. Although your answer wasn’t exactly what I was looking for, it encouraged me to keep going. My question stated a false fact, which I later discovered (per #1 above).