python - Django:使用 simple-history 模块我得到 auth_historicaluser 不存在错误

标签 python django ubuntu django-admin

我在 Windows 7 中使用 django 1.8,并且使用 django-simple-history 模块并且它工作正常。

在 Windows 上的 mysql 中查看我的表,我同时拥有 auth_historicaluserauth_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/

相关文章:

linux - docker在ubuntu vs linux aarch64上构建

python - 在 Python 中找出 2 个列表之间的区别

python - 创建 pandas 数据框的最快/计算效率最高的方法,其中列填充随机字符串,数百万行?

python - 如何获取反向排序列表的索引?

python - 在 Django 模板中渲染外部定义的 block

c - 非root用户的setuid等效项

python - 期间停止 Python 中的多行正则表达式替代?

django - 与(ASP.net MVC、NHibernate 和 Spark View Engine)相比,使用 Django 的缺点是什么?

python - 测试两个列表是否相等

android - 是否可以在 kubuntu12.04 (xubuntu) 中构建 AOSP 项目 (Gingerbread)?