环境:
请求方法:POST 请求网址:http://127.0.0.1:8000/admin/main/tutorial/add/
Django版本:2.1.4 Python版本:3.8.2
跟踪:
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/db/backends/utils.py" in _execute
85. return self.cursor.execute(sql, params)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/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 "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/core/handlers/exception.py" in inner
34. response = get_response(request)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/core/handlers/base.py" in _get_response
126. response = self.process_exception_by_middleware(e, request)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/core/handlers/base.py" in _get_response
124. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/contrib/admin/options.py" in wrapper
604. return self.admin_site.admin_view(view)(*args, **kwargs)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/utils/decorators.py" in _wrapped_view
142. response = view_func(request, *args, **kwargs)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/contrib/admin/sites.py" in inner
223. return view(request, *args, **kwargs)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/contrib/admin/options.py" in add_view
1637. return self.changeform_view(request, None, form_url, extra_context)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/utils/decorators.py" in _wrapper
45. return bound_method(*args, **kwargs)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/utils/decorators.py" in _wrapped_view
142. response = view_func(request, *args, **kwargs)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/contrib/admin/options.py" in changeform_view
1525. return self._changeform_view(request, object_id, form_url, extra_context)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/contrib/admin/options.py" in _changeform_view
1568. self.log_addition(request, new_object, change_message)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/contrib/admin/options.py" in log_addition
804. return LogEntry.objects.log_action(
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/contrib/admin/models.py" in log_action
29. return self.model.objects.create(
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/db/models/manager.py" in manager_method
82. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/db/models/query.py" in create
413. obj.save(force_insert=True, using=self.db)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/db/models/base.py" in save
717. self.save_base(using=using, force_insert=force_insert,
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/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 "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/db/models/base.py" in _save_table
831. result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/db/models/base.py" in _do_insert
868. return manager._insert([self], fields=fields, return_id=update_pk,
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/db/models/manager.py" in manager_method
82. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/db/models/query.py" in _insert
1136. return query.get_compiler(using=using).execute_sql(return_id)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/db/models/sql/compiler.py" in execute_sql
1289. cursor.execute(sql, params)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/db/backends/utils.py" in execute
100. return super().execute(sql, params)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/db/backends/utils.py" in execute
68. return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/db/backends/utils.py" in _execute_with_wrappers
77. return executor(sql, params, many, context)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/db/backends/utils.py" in _execute
85. return self.cursor.execute(sql, params)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/db/utils.py" in __exit__
89. raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/db/backends/utils.py" in _execute
85. return self.cursor.execute(sql, params)
File "/home/webdev/Desktop/my_django_app/venv/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py" in execute
296. return Database.Cursor.execute(self, query, params)
Exception Type: OperationalError at /admin/main/tutorial/add/
Exception Value: no such table: main.auth_user__old
答案 0 :(得分:0)
尝试以下命令:
python manage.py makemigrations
python manage.py migrate
,然后重新运行服务器。