Как убрать ошибку в работе Django? - PullRequest
0 голосов
/ 01 мая 2020

Я пытаюсь разработать свой первый веб-сайт (точнее, сайт электронной коммерции) с помощью учебника для начинающих. Добавляя все обязательные поля, я попытался сохранить детали для первого продукта. После этого я получил операционную ошибку в качестве ТИПА ИСКЛЮЧЕНИЯ и нет такой таблицы: main.auth_user__old в качестве значения исключения. Я предоставляю точный синтаксис ниже:

OperationalError at /admin/products/product/add/
no such table: main.auth_user__old
Request Method:
POST
Request URL:
http://127.0.0.1:8000/admin/products/product/add/
Django Version:
2.1
Exception Type:
OperationalError
Exception Value:
no such table: main.auth_user__old
Exception Location:
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\db\backends\sqlite3\base.py in execute, line 296
Python Executable:
C:\Users\RITAJA\PycharmProjects\P1\venv\Scripts\python.exe
Python Version:
3.8.2
Python Path:
['C:\\Users\\RITAJA\\PycharmProjects\\P1',
 'C:\\Users\\RITAJA\\AppData\\Local\\Programs\\Python\\Python38-32\\python38.zip',
 'C:\\Users\\RITAJA\\AppData\\Local\\Programs\\Python\\Python38-32\\DLLs',
 'C:\\Users\\RITAJA\\AppData\\Local\\Programs\\Python\\Python38-32\\lib',
 'C:\\Users\\RITAJA\\AppData\\Local\\Programs\\Python\\Python38-32',
 'C:\\Users\\RITAJA\\PycharmProjects\\P1\\venv',
 'C:\\Users\\RITAJA\\PycharmProjects\\P1\\venv\\lib\\site-packages',
 'C:\\Users\\RITAJA\\PycharmProjects\\P1\\venv\\lib\\site-packages\\setuptools-40.8.0-py3.8.egg',
 'C:\\Users\\RITAJA\\PycharmProjects\\P1\\venv\\lib\\site-packages\\pip-19.0.3-py3.8.egg']
Server time:
Fri, 1 May 2020 16:23:28 +0000

TRACEBACK : - Traceback Перейти к копированию и вставке

Traceback Switch to copy-and-paste view 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\db\backends\utils.py in _execute 
                return self.cursor.execute(sql, params) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\db\backends\sqlite3\base.py in execute 
        return Database.Cursor.execute(self, query, params) 
...
▶ Local vars 
The above exception (no such table: main.auth_user__old) was the direct cause of the following exception: 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\core\handlers\exception.py in inner 
            response = get_response(request) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\core\handlers\base.py in _get_response 
                response = self.process_exception_by_middleware(e, request) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\core\handlers\base.py in _get_response 
                response = wrapped_callback(request, *callback_args, **callback_kwargs) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\contrib\admin\options.py in wrapper 
                return self.admin_site.admin_view(view)(*args, **kwargs) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\utils\decorators.py in _wrapped_view 
                    response = view_func(request, *args, **kwargs) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\views\decorators\cache.py in _wrapped_view_func 
        response = view_func(request, *args, **kwargs) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\contrib\admin\sites.py in inner 
            return view(request, *args, **kwargs) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\contrib\admin\options.py in add_view 
        return self.changeform_view(request, None, form_url, extra_context) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\utils\decorators.py in _wrapper 
        return bound_method(*args, **kwargs) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\utils\decorators.py in _wrapped_view 
                    response = view_func(request, *args, **kwargs) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\contrib\admin\options.py in changeform_view 
            return self._changeform_view(request, object_id, form_url, extra_context) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\contrib\admin\options.py in _changeform_view 
                    self.log_addition(request, new_object, change_message) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\contrib\admin\options.py in log_addition 
        return LogEntry.objects.log_action( 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\contrib\admin\models.py in log_action 
        return self.model.objects.create( 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\db\models\manager.py in manager_method 
                return getattr(self.get_queryset(), name)(*args, **kwargs) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\db\models\query.py in create 
        obj.save(force_insert=True, using=self.db) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\db\models\base.py in save 
        self.save_base(using=using, force_insert=force_insert, 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\db\models\base.py in save_base 
            updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\db\models\base.py in _save_table 
            result = self._do_insert(cls._base_manager, using, fields, update_pk, raw) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\db\models\base.py in _do_insert 
        return manager._insert([self], fields=fields, return_id=update_pk, 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\db\models\manager.py in manager_method 
                return getattr(self.get_queryset(), name)(*args, **kwargs) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\db\models\query.py in _insert 
        return query.get_compiler(using=using).execute_sql(return_id) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\db\models\sql\compiler.py in execute_sql 
                cursor.execute(sql, params) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\db\backends\utils.py in execute 
            return super().execute(sql, params) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\db\backends\utils.py in execute 
        return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\db\backends\utils.py in _execute_with_wrappers 
        return executor(sql, params, many, context) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\db\backends\utils.py in _execute 
                return self.cursor.execute(sql, params) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\db\utils.py in __exit__ 
                raise dj_exc_value.with_traceback(traceback) from exc_value 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\db\backends\utils.py in _execute 
                return self.cursor.execute(sql, params) 
...
▶ Local vars 
C:\Users\RITAJA\PycharmProjects\P1\venv\lib\site-packages\django\db\backends\sqlite3\base.py in execute 
        return Database.Cursor.execute(self, query, params) 
...
▶ Local vars
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...