源代码为:
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
class BlogArticles(models.Model):
title = models.CharField(max_length=300)
author = models.ForeignKey(User, related_name="blog_posts")
body = models.TextField()
publish = models.DateTimeField(default=timezone.now)
class Meta:
ordering = ("-publish",)
def __str__(self):
return self.titile
E:\python项目\project1>python manage.py makemigrations
输入以上命令,报错:
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "D:\python\Python36\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "D:\python\Python36\lib\site-packages\django\core\management\__init__.py", line 357, in execute