Take the 2-minute tour ×

Here is my setup. I am using Django version 1.1.1 on Dreamhost, Python 2.4. The problem I am having is whenever I create a simple app and also have admin.autodiscover() enabled, Django will throw an exception. My setup:

from django.conf.urls.defaults import *
from testapp.views import HelloWorld

from django.contrib import admin

urlpatterns = patterns('',
    (r'^HelloWorld/$', HelloWorld),

    # to INSTALLED_APPS to enable admin documentation:

    # Uncomment the next line to enable the admin:

My settings.py looks like:


My testapp.views looks like:

from django.http import HttpResponse

def HelloWorld(request):
    return HttpResponse("Hello world")

If I comment out admin.autodiscover() I can get to my view of HelloWorld. If I enable admin.autodiscover() Django throws an exception that I am not able to trap.

Does anyone know why this might be happening and what I can do to fix it?

share|improve this question
Do you have any info about the error at all? A printout/trace? Set debug=True in settings to make sure you get the error screen. –  sotangochips Dec 21 '09 at 17:41
Could you add the exception message as well? You usually get pretty descriptive exceptions from Django (and Python in general). –  Kristian Dec 21 '09 at 17:43
I had endless inexplicable Django errors on dreamhost. I finally switched to webfaction which explicitly supports Django. What I don't remember about dreamhost is if you get log files? You got nothing, no tracebacks? On webfaction you get a log directory per app. –  EMiller Dec 21 '09 at 17:44
I do have debug=True but the problem is that the exception happens before Django can report it. Even if I setup Django to send emails on "500 Internal Server Error" it appears as though the exceptions happen before Django can even report it. –  letsgofast Dec 21 '09 at 17:50
Can you show us your urls.py? –  diegueus9 Dec 21 '09 at 18:02
show 4 more comments

2 Answers

I've had a similar issue when I've renamed an app. Basically, if you've launched the app and used the admin using admin.autodiscover() in your urls.py file, it will cause an admin.pyc file to be created in your app folder. Delete this admin.pyc file and run the server again...and voila!

share|improve this answer
add comment

I'm going to guess that testapp/admin.py does not import the models.Model class you are creating admin for. Try the following:

./manage.py shell # you may immediately get a stack trace
>> import testapp.admin # I'll bet it blows up.
share|improve this answer
Yep - when I get try to import testapp.admin I get an ImportError exception –  letsgofast Dec 21 '09 at 18:22
add comment

Your Answer


