Traceback (most recent call last):
File "D:\myspace\testone\testone\blog\models.py", line 4, in <module>
class BlogPost(models.Model):
File "F:\Python\Lib\site-packages\django\db\models\base.py", line 52, in __new__
kwargs = {"app_label": model_module.__name__.split('.')[-2]}
IndexError: list index out of range
用django建立个blog...其余都配置好了...结果出现这个问题.
models.py代码:
from django.db import models
from django.contrib import admin
class BlogPost(models.Model):
title = models.CharField(max_length=250)
body = models.TextField()
timestamp = models.DateTimeField()
admin.site.register(BlogPost)