码迷,mamicode.com
首页 > 其他好文 > 详细

Table ‘MyDjango.django_admin_log‘ doesn‘t exist

时间:2020-09-21 12:14:22      阅读:56      评论:0      收藏:0      [点我收藏+]

标签:ack   使用   end   mysql   sep   roo   mys   evel   version   

使用django_damin后台时,数据库没有自动生成django_admin_log,需要单独迁移文件admin应用

python manage.py makemigrations admin
python manage.py migrate admin

报错如下:

    err.raise_mysql_exception(self._data)
  File "/usr/local/python36/lib/python3.6/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
    raise errorclass(errno, errval)
django.db.utils.ProgrammingError: (1146, "Table ‘polls.django_admin_log‘ doesn‘t exist")
[18/Sep/2020 18:42:35] "GET /admin/ HTTP/1.1" 500 350858

迁移admin应用

[root@opsys-vm15-253 mysite]# python3 manage.py makemigrations admin
Migrations for ‘admin‘:
  /usr/local/python36/lib/python3.6/site-packages/django/contrib/admin/migrations/0001_initial.py
    - Create model LogEntry
[root@opsys-vm15-253 mysite]# python3 manage.py migrate admin
Operations to perform:
  Apply all migrations: admin
Running migrations:
  Applying admin.0001_initial... OK
[root@opsys-vm15-253 mysite]# python3 manage.py runserver 0.0.0.0:8000
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
September 18, 2020 - 19:18:23
Django version 2.2.3, using settings ‘mysite.settings‘
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.

#end

Table ‘MyDjango.django_admin_log‘ doesn‘t exist

标签:ack   使用   end   mysql   sep   roo   mys   evel   version   

原文地址:https://blog.51cto.com/qhd2004/2535483

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!