How to (re)enable Django's admin docs

| 2 Comments | No TrackBacks
If you've used Django before, you may have remembered that Django's admin pages had a Documentation link in the top right corner. This lead to a site which provided documentation for all Models, Views, Tags and Filters that exist in your project, which is immensely useful for devs and designers alike.

In the newer versions of Django this has seemingly disappeared, and the official documentation makes very little mention of it, as it has been split into its own (as of yet undocumented) app. So, you have to enable it yourself by adding the admindocs app and setting up an url pattern for it.

So, to accomplish this, first open up your settings.py and add 'django.contrib.admindocs' to your INSTALLED_APPS, set a SITE_ID if you haven't done so already, then do the following with your urls.py:

urlpatterns = patterns(
    '',
    (r'^admin/doc/', include('django.contrib.admindocs.urls')),
    (r'^admin/(.*)', admin.site.root), # Standard admin url pattern
    # Other URL patterns go here
)
Note that the admindocs pattern has to go before the standard admin pattern, because Django gives you the first view from the top that matches, and the admin pattern is very hungry. :)

Now when you go into the admin section, you should have a shiny new Documentation link that leads to Django's automatic documentation for your project. Enjoy!

No TrackBacks

TrackBack URL: http://ircubic.net/cgi-bin/mt/mt-tb.cgi/3

2 Comments

We are a group of volunteers and starting a new initiative in a community. Your blog provided us valuable information to work on.You have done a marvellous job!

Thanks very much for sharing this interesting post. I am just starting up my own blog and this has given me inspiration to what I can achieve.

Leave a comment

About me

I am Daniel E. Bruce, a Python and .NET coder.

Currently working on Renraku OS, in addition to some personal Python web projects, using both Django and Pylons.

More info:

About this Entry

This page contains a single entry by Daniel E. Bruce published on November 27, 2009 6:43 PM.

Portable Django project with Buildout was the previous entry in this blog.

Robots, Image Recognition and Path-finding, oh my! is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

December 2011

Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
OpenID accepted here Learn more about OpenID
Powered by Movable Type 5.01