django 1.9.4 创建管理帐号后,无auth_user表的问题

shandyli 2017-06-28 05:08:05
django1.9.4

新建项目
django-admin.py startproject testop

python manage.py migrate

python manage.py createsuperuser(比如帐号名:testadmin)

python manage.py runserver 0.0.0.0:800

访问http://10.10.10.1:800/admin,出来登录框,
(setting里已经写了连接数据库的相关字段,testop库也已经建立)
用testadmin帐号登录,会出来如下错误
**************************************************************
ProgrammingError at /admin/login/
(1146, "Table 'testop.auth_user' doesn't exist")
Request Method: POST
Request URL: http://10.10.10.1:800/admin/login/?next=/admin/
Django Version: 1.9.4
Exception Type: ProgrammingError
Exception Value:
(1146, "Table 'testop.auth_user' doesn't exist")
Exception Location: /usr/local/lib/python2.7/site-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg/MySQLdb/connections.py in defaulterrorhandler, line 36
Python Executable: /usr/local/bin/python
Python Version: 2.7.2
Python Path:
['/data/testop',
'/usr/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
'/usr/local/lib/python2.7/site-packages/Django-1.9.4-py2.7.egg',
'/usr/local/lib/python2.7/site-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg',
'/usr/local/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg',
'/usr/local/lib/python27.zip',
'/usr/local/lib/python2.7',
'/usr/local/lib/python2.7/plat-linux2',
'/usr/local/lib/python2.7/lib-tk',
'/usr/local/lib/python2.7/lib-old',
'/usr/local/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/site-packages']
Server time: Wed, 28 Jun 2017 08:49:04 +0000
*********************************************************************************
在testop库里,也确实没发现auth_user表。
以前在1.3上没遇到这问题。
请问还需要做什么操作才能自动生成auth_user表呢?
谢谢

...全文
612 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
shandyli 2017-07-11
  • 打赏
  • 举报
回复
感谢,可以了。 前面不知道什么原因,没生成全的user相关表。 后来把相关的存在表删除后,再重新运行一次命令就好了。
混沌鳄鱼 2017-06-28
  • 打赏
  • 举报
回复
python manage.py makemigrations [app] python manage.py migrate [app] python manage.py makemigrations auth python manage.py migrate auth

37,719

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧