使用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