django create superuser failed

得到以上界面后自然希望能够登录进行操作,此时需要创建用户,但在执行python manage.py  createsuperuser 时报以下错误:

return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: auth_user

从报错提示可以看出是不存在对应的数据表,实际上是由于创建的模型没有迁移到数据库,此时只需要执行python manage.py makemigrations

接着执行python manage.py migrate

最后再执行python manage.py  createsuperuser 就可以了。

猜你喜欢

转载自blog.csdn.net/haiziccc/article/details/91419915
今日推荐