我遵循的是官方Django文档中的第一个应用程序教程,尝试保存通过管理页面进行的某些更改时出现此错误。我对此进行了一些研究,但是我能够找到的可能解决方案(例如迁移数据库)根本行不通。如果您想查看我的代码的某些特定部分,请告诉我。
以下是错误:
OperationalError at /admin/polls/question/1/change/ no such table: main.auth_user__old Request Method: POST Request URL: http://127.0.0.1:8000/admin/polls/question/1/change/ Django Version: 2.1.4 Exception Type: OperationalError Exception Value: no such table: main.auth_user__old Exception Location: /Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py in execute, line 296 Python Executable: /Users/gfioravante/Projects/test_app/ta_env/bin/python3 Python Version: 3.7.1 Python Path:
['/Users/gfioravante/Projects/test_app/test_app', '/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', '/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload', '/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages'] Server time: Wed, 5 Dec 2018 16:45:00 +0000
and the traceback:
Environment:
Request Method: POST Request URL: http://127.0.0.1:8000/admin/polls/question/1/change/
Django Version: 2.1.4 Python Version: 3.7.1 Installed Applications: ['polls.apps.PollsConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback:
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/db/backends/utils.py" in _execute 85. return self.cursor.execute(sql, params)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py" in execute 296. return Database.Cursor.execute(self, query, params)
The above exception (no such table: main.auth_user__old) was the direct cause of the following exception:
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/core/handlers/exception.py" in inner 34. response = get_response(request)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response 126. response = self.process_exception_by_middleware(e, request)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response 124. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/contrib/admin/options.py" in wrapper 604. return self.admin_site.admin_view(view)(*args, **kwargs)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/utils/decorators.py" in _wrapped_view 142. response = view_func(request, *args, **kwargs)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func 44. response = view_func(request, *args, **kwargs)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/contrib/admin/sites.py" in inner 223. return view(request, *args, **kwargs)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/contrib/admin/options.py" in change_view 1640. return self.changeform_view(request, object_id, form_url, extra_context)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/utils/decorators.py" in _wrapper 45. return bound_method(*args, **kwargs)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/utils/decorators.py" in _wrapped_view 142. response = view_func(request, *args, **kwargs)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/contrib/admin/options.py" in changeform_view 1525. return self._changeform_view(request, object_id, form_url, extra_context)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/contrib/admin/options.py" in _changeform_view 1571. self.log_change(request, new_object, change_message)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/contrib/admin/options.py" in log_change 826. change_message=message,
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/contrib/admin/models.py" in log_action 35. change_message=change_message,
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/db/models/manager.py" in manager_method 82. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/db/models/query.py" in create 413. obj.save(force_insert=True, using=self.db)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/db/models/base.py" in save 718. force_update=force_update, update_fields=update_fields)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/db/models/base.py" in save_base 748. updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/db/models/base.py" in _save_table 831. result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/db/models/base.py" in _do_insert 869. using=using, raw=raw)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/db/models/manager.py" in manager_method 82. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/db/models/query.py" in _insert 1136. return query.get_compiler(using=using).execute_sql(return_id)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/db/models/sql/compiler.py" in execute_sql 1289. cursor.execute(sql, params)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/db/backends/utils.py" in execute 100. return super().execute(sql, params)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/db/backends/utils.py" in execute 68. return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/db/backends/utils.py" in _execute_with_wrappers 77. return executor(sql, params, many, context)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/db/backends/utils.py" in _execute 85. return self.cursor.execute(sql, params)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/db/utils.py" in exit 89. raise dj_exc_value.with_traceback(traceback) from exc_value
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/db/backends/utils.py" in _execute 85. return self.cursor.execute(sql, params)
File "/Users/gfioravante/Projects/test_app/ta_env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py" in execute 296. return Database.Cursor.execute(self, query, params)
Exception Type: OperationalError at /admin/polls/question/1/change/ Exception Value: no such table: main.auth_user__old
我自己碰到了这个问题,它似乎与https://code.djangoproject.com/ticket/29182有关。现在,您只需将sqlite版本降级到2.6之前的版本(例如2.5.1)
问题内容: 我正在使用Django-CMS的Django项目中构建一个相当简单的应用程序,即研究项目。(这是我对项目/应用程序的首次尝试。)它的主要目的是存储各种知识资产(例如,研究人员撰写的文章,书籍等)。 问题是,当我将浏览器指向/ research /时,出现一条错误,提示表’research_journal’不存在(“ no such table”)。 我正在使用带有sqlite3数据库的
当我想登录或注册时,我为registration AdvUser添加了用户类,或者当我收到错误时,我为createsuperuser添加了用户类: 异常值:没有这样的表:vacancy_list_advuser 文件“/home/alex/dev/python/django/junjob/myvenv/lib/python3.5/site packages/django/db/backends/s
当使用nginx uwsgi主管部署Django项目时存在问题。在Ubuntu上使用命令方法时一切正常,但在监督中失败了,希望有人能帮我度过难关。 工作罚款: 在主管中启动程序时出错信息: mysite2_uwsgi。ini: /etc/主管。形态 设置。派克 /etc/nginx/sites-available/mysite2.conf
我正在尝试使用Android Room,在完成本教程后,我在尝试构建应用程序时遇到以下错误: 这个名字很好,应该存在。在进行更改后,我清理了项目并确保它已从设备中完全卸载。 在我的中,我用这一行初始化中的内容: 这是我的代码: 应用数据库 许可证 许可证
问题内容: 我试图让我的应用程序使用保存布尔值来更改屏幕的方向时保存一些数据。 我已经设置了许多断点,并且在变量视图中得到了布尔值的错误 我不知道为什么要在启动活动时用false值声明它,如果按下按钮将其更改为true。谁能帮我吗? 问题答案: 检查您的Android Studio中的构建变体是否具有 可调试 为真 proguard 被禁用或已被注释掉。
问题内容: 运行时,出现此错误: : 问题答案: 旧的缓存导致了此问题,我第一次无法运行此命令,并且docker-compose已经创建的映像,我从中看不到。 需要从检查,并使用此命令删除所有旧图像,然后再次重建。