Apps not showing in Django admin site
I have a Django project with about 10 apps in it. But the admin interface only shows Auth and Site models which are part of Django distribution. Yes, the admin interface is up and working but none of my self-written apps shows there.
INSTALLED_APPS
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.sites',
'django.contrib.contenttypes',
'django.contrib.humanize',
'django.contrib.sessions',
'django.contrib.admin',
'django.contrib.admindocs',
'project.app1',
...
app1/admin.py
from django.contrib import admin
from project.app1.models import *
admin.site.register(model1)
admin.site.register(model2)
admin.site.register(model3)
What coul开发者_如何学Pythond be wrong in this case? Looks like everything is configured as what document says.
Thank you in advance.
Which version of Django are you using? Support for files named admin.py was added in version 1.0 (I think). Before that, you'd have to add extra information to your model.
If something in your app throws an exception, the app or model may be excluded from the admin on subsequent requests.
If that is the case, you should get an error on the first request.
Also, please make sure your URLCONF has admin.autodiscover()
精彩评论