为什么这个模块不在django 1.4管理界面中显示?

时间:2012-05-17 14:45:59

标签: python django

目录结构

tutorial/tutorials
turotial/tutorial

教程/ settings.py

 INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
#'domains'
'tutorials'    
)

教程/ admin.py

from tutorials.models import Tutorial
from django.contrib import admin

admin.site.register(Tutorial)
# Create your views here.

教程/ models.py

from django.db import models

class Tutorial(models.Model):
    name = models.CharField(max_length=200)
    url = models.CharField(max_length=200)

    def __unicode__(self):
        return self.name

class User(models.Model):
    name = models.CharField(max_length=200)

    def __unicode__(self):
        return self.name

class Country(models.Model):
    name = models.CharField(max_length=200)

    def __unicode__(self):
        return self.name

2 个答案:

答案 0 :(得分:1)

很少有事情可以帮助您找到问题:

  • 您的urls.py
  • 中有admin.autodiscover()吗?
  • 您是否运行了syncdb
  • 您是否尝试打开manage.py shell并导入模型以查看是否存在错误。

答案 1 :(得分:0)

您可能在此应用的INSTALLED_APPS设置中没有条目。