问题描述
我正在阅读DjangoBook 2.0版,我刚刚创建了我的第一个应用程序,并将其添加到settings.py中的INSTALLED_APPS设置属性中
I'm reading the DjangoBook version 2.0, and i've just created my first app and added it to INSTALLED_APPS setting attribute in settings.py
我已使用:
因此,它的名字是'books'.
therefore, it's name is 'books'.
我添加了书中写的模型,
i added the models as written on the book,
class Publisher(models.Model):
name = models.CharField(max_length=30)
address = models.CharField(max_length=50)
city = models.CharField(max_length=60)
state_province = models.CharField(max_length=30)
country = models.CharField(max_length=50)
website = models.URLField()
class Author(models.Model):
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=40)
email = models.EmailField()
class Book(models.Model):
title = models.CharField(max_length=100)
authors = models.ManyToManyField(Author)
publisher = models.ForeignKey(Publisher)
publication_date = models.DateField()
在验证添加的应用程序之后,使用
After validating the added app, using
我收到以下输出:
* 我添加到INSTALLED_APPS的数据是"mysite.books",因为我的项目名称是mysite.
* The data i added to INSTALLED_APPS is 'mysite.books' because my project's name is mysite.
我的行为出了什么问题?
What is wrong with my actions ?
推荐答案
http://thedjangoforum.com/board/thread/1180/python-managepy-validate-error-no-mod/
这是答案.它解决了我的问题.
here is the answer. it solved my problem.
问题解决后,应将"mysite.books"更改为"books""
"you should change 'mysite.books', into 'books' after that your problem will end"
尝试!
这篇关于按照DjangoBook所述创建我的第一个应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!