Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Can';在django上进行makemigrations之后,不能进行迁移_Python_Python 3.x_Django_Python 2.7 - Fatal编程技术网

Python Can';在django上进行makemigrations之后,不能进行迁移

Python Can';在django上进行makemigrations之后,不能进行迁移,python,python-3.x,django,python-2.7,Python,Python 3.x,Django,Python 2.7,各位。我是这个领域的新手。所以,在我完成makemigrations之后。然后我迁移这个错误代码。我试图解决它,但还是卡住了。请引导,我附上我的错误代码如下 (venv) C:\Users\hp\Desktop\Taskly_App\src>python manage.py migrate Operations to perform: Apply all migrations: admin, auth, contenttypes, house, oauth2_provider, se

各位。我是这个领域的新手。所以,在我完成makemigrations之后。然后我迁移这个错误代码。我试图解决它,但还是卡住了。请引导,我附上我的错误代码如下

(venv) C:\Users\hp\Desktop\Taskly_App\src>python manage.py migrate
Operations to perform:
   Apply all migrations: admin, auth, contenttypes, house, oauth2_provider, sessions, social_django, task, users
Running migrations:
  Applying task.0002_auto_20210331_2329...Traceback (most recent call last):
  File "C:\Users\hp\Desktop\Taskly_App\venv\lib\site-packages\django\db\backends\utils.py", line 82, in _execute
    return self.cursor.execute(sql)
  File "C:\Users\hp\Desktop\Taskly_App\venv\lib\site-packages\django\db\backends\sqlite3\base.py", line 411, in execute
    return Database.Cursor.execute(self, query)
sqlite3.OperationalError: table "task_tasklist" already exists

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    main()
  File "manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\hp\Desktop\Taskly_App\venv\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "C:\Users\hp\Desktop\Taskly_App\venv\lib\site-packages\django\core\management\__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\hp\Desktop\Taskly_App\venv\lib\site-packages\django\core\management\base.py", line 330, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\hp\Desktop\Taskly_App\venv\lib\site-packages\django\core\management\base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "C:\Users\hp\Desktop\Taskly_App\venv\lib\site-packages\django\core\management\base.py", line 85, in wrapped
    res = handle_func(*args, **kwargs)
  File "C:\Users\hp\Desktop\Taskly_App\venv\lib\site-packages\django\core\management\commands\migrate.py", line 243, in handle
    post_migrate_state = executor.migrate(
  File "C:\Users\hp\Desktop\Taskly_App\venv\lib\site-packages\django\db\migrations\executor.py", line 117, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "C:\Users\hp\Desktop\Taskly_App\venv\lib\site-packages\django\db\migrations\executor.py", line 147, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "C:\Users\hp\Desktop\Taskly_App\venv\lib\site-packages\django\db\migrations\executor.py", line 227, in apply_migration
    state = migration.apply(state, schema_editor)
  File "C:\Users\hp\Desktop\Taskly_App\venv\lib\site-packages\django\db\migrations\migration.py", line 124, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "C:\Users\hp\Desktop\Taskly_App\venv\lib\site-packages\django\db\migrations\operations\models.py", line 92, in database_forwards
    schema_editor.create_model(model)
  File "C:\Users\hp\Desktop\Taskly_App\venv\lib\site-packages\django\db\backends\base\schema.py", line 324, in create_model
    self.execute(sql, params or None)
  File "C:\Users\hp\Desktop\Taskly_App\venv\lib\site-packages\django\db\backends\base\schema.py", line 142, in execute
    cursor.execute(sql, params)
  File "C:\Users\hp\Desktop\Taskly_App\venv\lib\site-packages\django\db\backends\utils.py", line 98, in execute
    return executor(sql, params, many, context)
  File "C:\Users\hp\Desktop\Taskly_App\venv\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "C:\Users\hp\Desktop\Taskly_App\venv\lib\site-packages\django\db\utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "C:\Users\hp\Desktop\Taskly_App\venv\lib\site-packages\django\db\backends\utils.py", line 82, in _execute
    return self.cursor.execute(sql)
  File "C:\Users\hp\Desktop\Taskly_App\venv\lib\site-packages\django\db\backends\sqlite3\base.py", line 411, in execute
    return Database.Cursor.execute(self, query)
django.db.utils.OperationalError: table "task_tasklist" already exists
(venv)C:\Users\hp\Desktop\Taskly\u App\src>python manage.py迁移
要执行的操作:
应用所有迁移:admin、auth、contenttypes、house、oauth2_提供者、会话、social_django、任务、用户
运行迁移:
正在应用task.0002_auto_20210331_2329…回溯(最近一次调用上次):
文件“C:\Users\hp\Desktop\Taskly\u App\venv\lib\site packages\django\db\backends\utils.py”,第82行,在执行中
返回self.cursor.execute(sql)
文件“C:\Users\hp\Desktop\Taskly\u App\venv\lib\site packages\django\db\backends\sqlite3\base.py”,第411行,在execute中
返回Database.Cursor.execute(self,query)
sqlite3.2错误:表“任务\任务列表”已存在
上述异常是以下异常的直接原因:
回溯(最近一次呼叫最后一次):
文件“manage.py”,第22行,在
main()
文件“manage.py”,第18行,主
从命令行(sys.argv)执行命令
文件“C:\Users\hp\Desktop\Taskly\u App\venv\lib\site packages\django\core\management\\uuuuu init\uuuuuu.py”,第401行,从命令行执行
utility.execute()
文件“C:\Users\hp\Desktop\Taskly\u App\venv\lib\site packages\django\core\management\\uuuuu init\uuuuu.py”,第395行,在execute中
self.fetch_命令(子命令)。从_argv(self.argv)运行_
文件“C:\Users\hp\Desktop\Taskly\u App\venv\lib\site packages\django\core\management\base.py”,第330行,运行于\u argv
self.execute(*args,**cmd_选项)
文件“C:\Users\hp\Desktop\Taskly\u App\venv\lib\site packages\django\core\management\base.py”,第371行,在execute中
输出=self.handle(*args,**选项)
文件“C:\Users\hp\Desktop\Taskly\u App\venv\lib\site packages\django\core\management\base.py”,第85行,包装为
res=句柄函数(*args,**kwargs)
文件“C:\Users\hp\Desktop\Taskly\u App\venv\lib\site packages\django\core\management\commands\migrate.py”,第243行,在handle中
post\u migrate\u state=executor.migrate(
文件“C:\Users\hp\Desktop\Taskly\u App\venv\lib\site packages\django\db\migrations\executor.py”,第117行,在migrate中
状态=self.\u迁移\u所有\u转发(状态,计划,完整计划,假=假,假首字母=假首字母)
文件“C:\Users\hp\Desktop\Taskly\u App\venv\lib\site packages\django\db\migrations\executor.py”,第147行,全部向前迁移
state=self.apply\u迁移(state,migration,false=false,false\u initial=false\u initial)
文件“C:\Users\hp\Desktop\Taskly\u App\venv\lib\site packages\django\db\migrations\executor.py”,第227行,在apply\u migration中
state=migration.apply(状态,模式编辑器)
文件“C:\Users\hp\Desktop\Taskly\u App\venv\lib\site packages\django\db\migrations\migration.py”,第124行,在apply中
操作。数据库转发(self.app\u标签、模式编辑器、旧状态、项目状态)
数据库中的文件“C:\Users\hp\Desktop\Taskly\u App\venv\lib\site packages\django\db\migrations\operations\models.py”第92行
架构编辑器。创建模型(模型)
文件“C:\Users\hp\Desktop\Taskly\u App\venv\lib\site packages\django\db\backends\base\schema.py”,第324行,在create\u模型中
self.execute(sql、参数或无)
文件“C:\Users\hp\Desktop\Taskly\u App\venv\lib\site packages\django\db\backends\base\schema.py”,执行中第142行
cursor.execute(sql,params)
文件“C:\Users\hp\Desktop\Taskly\u App\venv\lib\site packages\django\db\backends\utils.py”,第98行,在execute中
返回执行器(sql、参数、多个、上下文)
文件“C:\Users\hp\Desktop\Taskly\u App\venv\lib\site packages\django\db\backends\utils.py”,第84行,在执行中
返回self.cursor.execute(sql,params)
文件“C:\Users\hp\Desktop\Taskly\u App\venv\lib\site packages\django\db\utils.py”,第90行,在退出时__
使用exc_值的_回溯(回溯)提高dj_exc_值
文件“C:\Users\hp\Desktop\Taskly\u App\venv\lib\site packages\django\db\backends\utils.py”,第82行,在执行中
返回self.cursor.execute(sql)
文件“C:\Users\hp\Desktop\Taskly\u App\venv\lib\site packages\django\db\backends\sqlite3\base.py”,第411行,在execute中
返回Database.Cursor.execute(self,query)
django.db.utils.OperationalError:表“task\u tasklist”已存在
我不知道任务列表错误是什么意思


请帮帮我!!

错误消息不言自明:


“任务列表”表已经存在于我们的数据库中

这是否回答了您的问题?非常感谢您的指导。