Search code examples
pythondjangodjango-adminpinax

Apps won't show in Django admin


I've read all the other threads but I still don't get why my apps are not showing up in Django admin. Everything else works fine.

My apps are in settings.py

I have admin.autodiscover in my root urls.py file

from django.conf.urls.defaults import *
from django.conf import settings

from django.views.generic.simple import direct_to_template

from django.contrib import admin

admin.autodiscover()



urlpatterns = patterns('',
url(r'^$', direct_to_template, {
    "template": "homepage.html",
}, name="home"),

url(r'^admin/invite_user/$', 'signup_codes.views.admin_invite_user', name="admin_invite_user"),
url(r'^account/signup/$', "signup_codes.views.signup", name="acct_signup"),

(r'^account/', include('account.urls')),
(r'^profiles/', include('basic_profiles.urls')),
(r'^notices/', include('notification.urls')),
(r'^announcements/', include('announcements.urls')),
(r'^tagging_utils/', include('tagging_utils.urls')),
(r'^attachments/', include('attachments.urls')),
(r'^comments/', include('threadedcomments.urls')),
#
(r'^wayfinder/', include('wayfinder.urls')),
(r'^site/', include('jsite.urls')),
(r'^kiosk/', include('kiosk.urls')),
(r'^navigator/', include('navigator.urls')),
(r'^location/', include('location.urls')),
(r'^event/', include('event.urls')),
#(r'^news_reader/', include('news_reader.urls')),
#(r'^weather_reader/', include('weather_reader.urls')),

(r'^admin/(.*)', admin.site.root),
)

if settings.SERVE_MEDIA:
urlpatterns += patterns('',
    (r'^site_media/', include('staticfiles.urls')),
)

All my apps have an admin.py file containing something like

from django.contrib import admin
from event.models import Event

class EventAdmin(admin.ModelAdmin):
    list_display = (
                'short_name',
                'long_name',
                'locations',
                'categories',
                'description',
                'phone',
                'email',
                'url_source',
                'url_location',
                'external_ref',
                'show_event'
            )

admin.site.register(Event, EventAdmin)

And I have restarted the server over and over ;-)

I am building on top of Pinax, but from my reading, it shouldn't change anything. Any clue what might be wrong ?


Solution

  • Do you have your apps in the INSTALLED_APPS section in settings.py? Make sure it has your apps listed there. My section reads

    INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.admin',
    'django.contrib.sites',
    'squick.items',
    'cowsite.search',
    'cowsite.posts',
    

    )

    for instance. I'm pretty sure for security, they won't show up in the admin unless they are in installed apps. I think I had this same issue, where I couldn't get cowsite to show up in the admin.

    The Django docs say about the admin page: "By default, it displays all the apps in INSTALLED_APPS that have been registered with the admin application, in alphabetical order"