Hi,
I am building a new site in Django 1.4 and I'm using the South migration tool to keep my dev MySQL database in sync with changes made to my models. It should be said that I use one MySQL database account to serve various Django projects/apps (confusing, yes). It all seems to be working fine until I attempt to open up the Admin site from the project currently in development (bus/certs/admin/).
It *appears* that the autodiscover is trying to find a model "Listing" that is no longer in existence, but did exist in earlier development stages. I deleted that model and have since run a South migration to extend that deletion to the database. That seems to have worked fine. What did not seem to happen is the removal of references to the "listing" table in the django_content_type and auth_permission tables, so I removed those manually thinking the autodiscover might be "seeing" those entries and subsequently attempting to find the model in "bus_models.models". That seems to have made no difference, the error still exists.
Not sure if this matters or not, but I had initially used the admin up in a separate project ("deans" vs. "certs") and it still works. It even still lists the "Bus_models.Listing" model and only fails once I click on that link...gives me a "Table does not exist" error, as I would expect. This does make me think, however, that there is a lingering pointer somewhere that I'm unable to locate.
I can reliably cause this error to occur and go away again by uncommenting/commenting the following lines in my bus(app)/certs(proj)/urls.py file:
from django.contrib import admin
admin.autodiscover()
(r'^apps/bus/certs/admin/', include(admin.site.urls)),
Here is the traceback of the error page that shows up when the above are uncommented (no matter what url I use):
Environment:
Request Method: GET
Request URL:
https://local.utexas.edu:8000/apps/bus/certs/application/1256/
Django Version: 1.4.3
Python Version: 2.6.7
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'utdirect',
'bus.certs.application',
'bus.certs.listing',
'bus.certs.common',
'bus.certs.bus_shared_common',
'bus.certs.bus_models',
'debug_toolbar',
'ut_debug_toolbar',
'south')
Installed Middleware:
('django.middleware.gzip.GZipMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'utdirect.middleware.HttpHeaderMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware')
Traceback:
File "/usr/local/env/26.3.4a/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
89. response = middleware_method(request)
File "/usr/local/env/26.3.4a/lib/python2.6/site-packages/utdirect/middleware.py" in process_request
160. request.urlconf = _build_urlconf(request)
File "/usr/local/env/26.3.4a/lib/python2.6/site-packages/utdirect/middleware.py" in _build_urlconf
123. class URLPatterns(object):
File "/usr/local/env/26.3.4a/lib/python2.6/site-packages/utdirect/middleware.py" in URLPatterns
130. url('', include(original_urlconf)),
File "/usr/local/env/26.3.4a/lib/python2.6/site-packages/django/conf/urls/__init__.py" in include
24. urlconf_module = import_module(urlconf_module)
File "/usr/local/env/26.3.4a/lib/python2.6/site-packages/django/utils/importlib.py" in import_module
35. __import__(name)
File "/pype/bus/certs/urls.py" in <module>
7. admin.autodiscover()
File "/usr/local/env/26.3.4a/lib/python2.6/site-packages/django/contrib/admin/__init__.py" in autodiscover
29. import_module('%s.admin' % app)
File "/usr/local/env/26.3.4a/lib/python2.6/site-packages/django/utils/importlib.py" in import_module
35. __import__(name)
Exception Type: NameError at /apps/bus/certs/application/1256/
Exception Value: name 'Listing' is not defined