我在 Windows 7 中使用 django 1.8,我使用 django-simple-history 模块,它工作正常。
在 Windows 上的 mysql 中查看我的表,我有 auth_historicaluser 和 auth_historicalgroup。
今天,我将我的项目移至 ubuntu 14.04 LTS,并安装了所有 installed_apps。
当我尝试创建 super 用户或访问 127.0.0.1:8000/admin 时,我的项目出现错误:
ProgrammingError at /admin/login/
(1146, "Table 'cy_thal.auth_historicaluser' doesn't exist")
File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
django.db.utils.ProgrammingError: (1146, "Table 'cy_thal.auth_historicaluser' doesn't exist")
在 admin.py 我有:
from django.contrib.auth.models import User, Group
from simple_history import register
register(User,inherit=True)
register(Group, inherit=True)
请您参考如下方法:
我必须以 sudo 的身份运行此操作:
sudo python manage.py makemigrations app
sudo python manage.py syncdb
sudo python manage.py migrate auth
sudo python manage.py migrate
sudo python manage.py runserver
