directory stucture
tutorial/tutorials
turotial/tutorial
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'
)
tutorials/admin.py
from tutorials.models import Tutorial
from django.contrib import admin
admin.site.register(Tutorial)
# Create your views here.
tutorials/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
Few things to help finding the problem:
admin.autodiscover()
in your urls.py manage.py shell
and import the model to see if there are errors. 您的INSTALLED_APPS设置中可能没有此应用程序的条目。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.