我从官方的 Django 文档跟随 第一个应用程序教程,并且在尝试保存通过管理页面所做的一些更改时得到了这个错误。我对此做了一些研究,但是我能够找到的可能的解决方案,比如迁移数据库,根本不起作用。如果你想看我代码中的某些特定部分,请告诉我。
错误如下:
OperationalError/admin/poll/questions/1/change/no such table: Auth _ user _ _ old Request Method: POST Request 网址: http://127.0.0.1:8000/admin/polls/question/1/change/姜戈 版本: 2.1.4异常类型: OperationalError 异常值: no 这样的表: main.auth _ user _ _ old 异常 位置:/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/db/backend/sqlite3/base.py 在执行时,第296行 Python 可执行文件:/Users/gfioravante/Projects/test _ app/ta _ env/bin/python3 Python 版本: 3.7.1 Python Path:
[/Users/gfioravante/Projects/test _ app/test _ app’, ’/usr/local/Cellar/python/3.7.1/Frances/Python. Framework/Versions/3.7/lib/python37. zip’, ’/usr/local/Cellar/python/3.7.1/Frances/Python. Framework/Versions/3.7/lib/python3.7’, “/usr/local/Cellar/python/3.7.1/Framework/Python.Framework/Versions/3.7/lib/python3.7/lib-dynload”, “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package”] 服务器时间: 2018年12月5日星期三16:45:00 + 0000
还有追踪记录:
环境:
请求方法: POST 请求 URL: Http://127.0.0.1:8000/admin/polls/question/1/change/
Django 版本: 2.1.4 Python 版本: 3.7.1已安装的应用程序: [‘ polls.apps. PollsConfig’,‘ django.Contrib.admin’, ‘ django. Contrib.auth’,‘ django. Contrib.contenttype’, “ django 贡献会话”“ django 贡献信息” 已安装的中间件: 中间件,安全,安全中间件, “ django. Contrib.sessions.middleware. SessionMiddleware” “ django 中间件,通用中间件” 中间件, 中间件, 中间件, ‘ django. midware.clickjacking.XFrameOptionsMiddleware’]
追溯:
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/db/backend/utils.py” In _ execute 执行(sql,params)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/db/backend/sqlite3/base.py” 执行 执行(self,query,params)
上面的异常(没有这样的表: main.auth _ user _ _ old)是 下列例外情况的直接原因:
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/core/handlers/exction.py” 在内心深处 Response = get _ response (request)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/core/handlers/base.py” 得到回应 126.Response = self. process _ eption _ by _ Middle ware (e,request)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/core/handlers/base.py” 得到回应 124.Response = 包裝 _ callback (request,* callback _ args,* * callback _ kwargs)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/Contrib/admin/options.py” 用包装纸包着 返回 self. admin _ site. admin _ view (view)(* args,* * kwargs)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/utils/decorators.py” In _ 包裝 _ view 142.Response = view _ func (request,* args,* * kwargs)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/views/decators/cache.py” In _ 包裝 _ view _ func Response = view _ func (request,* args,* * kwargs)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/Contrib/admin/sites.py” 返回视图(request,* args,* * kwargs)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/Contrib/admin/options.py” 在 change _ view 中 返回 self. changeform _ view (request,object _ id,form _ url,tra _ context)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/utils/decorators.py” 包装 45. return bound _ method (* args,* * kwargs)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/utils/decorators.py” In _ 包裝 _ view 142.Response = view _ func (request,* args,* * kwargs)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/Contrib/admin/options.py” 在 changeform _ view 中 返回 self _ changeform _ view (request,object _ id,form _ url,tra _ context)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/Contrib/admin/options.py” In _ change _ view 1571年。Log _ change (request,new _ object,change _ message)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/Contrib/admin/options.py” 在 log _ change 中 Change _ message = message,
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/Contrib/admin/mods.py” In log _ action 变更消息 = 变更消息,
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/db/model/manager. py” 在 manager _ method 中 82.Return getattr (self. get _ queryset () ,name)(* args,* * kwargs)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/db/model/query.py” 创造 Save (force _ insert = True,using = self. db)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/db/model/base.py” 保存 718.Force _ update = force _ update,update _ fields = update _ fields)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/db/model/base.py” 在 save _ base 中 748.Update = self _ save _ table (raw,cls,force _ insert,force _ update,using,update _ fields)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/db/model/base.py” In _ save _ table Result = self _ do _ insert (cls. _ base _ manager,using,fields,update _ pk,raw)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/db/model/base.py” 插入 869.使用; 使用
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/db/model/manager. py” 在 manager _ method 中 82.Return getattr (self. get _ queryset () ,name)(* args,* * kwargs)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/db/model/query.py” 插入 1136. return query.get _ Editor (using = using) . execute _ sql (return _ id)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/db/model/sql/comper.py” 执行 _ sql 执行(sql,params)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/db/backend/utils.py” 执行 100. return super () . execute (sql,params)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/db/backend/utils.py” 执行 返回 self _ execute _ with _ wrappers (sql,params,many = False,Executive = self _ execute)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/db/backend/utils.py” In _ execute _ with _ wrappers 返回执行器(sql,params,many,context)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/db/backend/utils.py” In _ execute 执行(sql,params)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/db/utils.py” 在 出口 89.提高 dj _ exc _ value。With _ traceback (traceback) from exc _ value
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/db/backend/utils.py” In _ execute 执行(sql,params)
档案 “/Users/gfioravante/Projects/test _ app/ta _ env/lib/python3.7/site-package/django/db/backend/sqlite3/base.py” 执行 执行(self,query,params)
异常类型: OperationalError at/admin/poll/questions/1/change/ 异常值: 没有这样的表: main.auth _ user _ _ old