我在 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
关于python - Django:使用 simple-history 模块我得到 auth_historicaluser 不存在错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37542714/