我正在拔头发。我只是不能让迁移工作了。每次我运行python3 manage.py makemigrations
或python3 manage.py makemigrations app_name
我收到以下错误:
Traceback (most recent call last):
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 383, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: catalog_fault
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/core/management/base.py", line 361, in execute
self.check()
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/core/management/base.py", line 390, in check
include_deployment_checks=include_deployment_checks,
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/core/management/base.py", line 377, in _run_checks
return checks.run_checks(**kwargs)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/core/checks/registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/utils/functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/urls/resolvers.py", line 584, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/utils/functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/urls/resolvers.py", line 577, in urlconf_module
return import_module(self.urlconf_name)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/peter/Documents/21q/locallibrary/urls.py", line 60, in <module>
loader.load_db()
File "/home/peter/Documents/21q/catalog/loader.py", line 106, in load_db
add_game(*game, batch=True)
File "/home/peter/Documents/21q/catalog/models.py", line 315, in add_game
fault = add_fault(fault_name, batch=batch)
File "/home/peter/Documents/21q/catalog/models.py", line 327, in add_fault
fault = Fault.objects.get(fault__icontains = fault_name)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/db/models/query.py", line 402, in get
num = len(clone)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/db/models/query.py", line 256, in __len__
self._fetch_all()
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/db/models/query.py", line 1242, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/db/models/query.py", line 55, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1133, in execute_sql
cursor.execute(sql, params)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 99, in execute
return super().execute(sql, params)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/home/peter/.virtualenvs/21q_env/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 383, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: catalog_fault
我在 Stackoverflow 和其他网站上阅读了很多问答,但无法解决问题。
我已经尝试按照以下已接受答案中的步骤进行操作,但没有区别:Django - no such table exception
我已经尝试解决这个问题好几个小时了,但我还是无处可去。
感谢您的帮助!