用Django开发一款博客,按照教程一步步写下来,发现当我创建一个模型blogpost的时候,使用数据迁移
提示
Operations to perform:
Apply all migrations: admin, contenttypes, auth, sessions
Running migrations:
No migrations to apply.
最后找到原因是教程中只说在admin里注册了model,但是还需要在settings.py中注册一下
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'blogpost'
]
然后执行数据迁移就正确了
Operations to perform:
Apply all migrations: admin, blogpost, contenttypes, auth, sessions
Running migrations:
Rendering model states... DONE
Applying blogpost.0001_initial... OK
|