执行python manage.py runserver时提示ValueError("Dependency on app with no migrations: %s" % key[0])

问题截图

image.png
Performing system checks...

System check identified no issues (0 silenced).
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x10b726d90>
Traceback (most recent call last):
  File "/Users/zhangbin/py_envs/dailyfresh/lib/python3.7/site-packages/django/db/migrations/loader.py", line 166, in check_key
    return self.graph.root_nodes(key[0])[0]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/zhangbin/py_envs/dailyfresh/lib/python3.7/site-packages/django/utils/autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "/Users/zhangbin/py_envs/dailyfresh/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 120, in inner_run
    self.check_migrations()
  File "/Users/zhangbin/py_envs/dailyfresh/lib/python3.7/site-packages/django/core/management/base.py", line 442, in check_migrations
    executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
  File "/Users/zhangbin/py_envs/dailyfresh/lib/python3.7/site-packages/django/db/migrations/executor.py", line 18, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/Users/zhangbin/py_envs/dailyfresh/lib/python3.7/site-packages/django/db/migrations/loader.py", line 49, in __init__
    self.build_graph()
  File "/Users/zhangbin/py_envs/dailyfresh/lib/python3.7/site-packages/django/db/migrations/loader.py", line 226, in build_graph
    self.add_external_dependencies(key, migration)
  File "/Users/zhangbin/py_envs/dailyfresh/lib/python3.7/site-packages/django/db/migrations/loader.py", line 191, in add_external_dependencies
    parent = self.check_key(parent, key[0])
  File "/Users/zhangbin/py_envs/dailyfresh/lib/python3.7/site-packages/django/db/migrations/loader.py", line 173, in check_key
    raise ValueError("Dependency on app with no migrations: %s" % key[0])
ValueError: Dependency on app with no migrations: user

原因;

没有生成迁移文件导致的

解决办法:

执行python manage.py makemigrations命令

image.png
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容