Reputation: 11
I am following a tutorial on http://www.lightbird.net/dbe/todo_list.html to create a simple todo app. In one of the steps, I had to modify view to add an ability in 'admin' to mark tasks as done from that view. However I get the error ImportError at /admin/ no module named todo.
The error is not thrown from any particular line from the code so I do not know how to debug this. I am new to django. So I documented my error in my blog here: http://djangounchain.wordpress.com/2013/01/10/tutorial-8-todo-list-app/
Hope someone can help me!
Upvotes: 1
Views: 1738
Reputation: 2517
You are registering your models to AdminSite
in todo/models.py
itself.
As per official django documentation, you need to create admin.py
file inside your app for admin.autodiscover()
to work properly.
The last step in setting up the Django admin is to hook your AdminSite instance into your URLconf. Do this by pointing a given URL at the AdminSite.urls method.
In this example, we register the default AdminSite instance django.contrib.admin.site at the URL /admin/
# urls.py from django.conf.urls import patterns, url, include from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), )
Above we used admin.autodiscover() to automatically load the INSTALLED_APPS admin.py modules.
Upvotes: 2