执行python manage.py runserver时提示V

2019-02-17  本文已影响0人  CoderZb

问题截图

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
上一篇 下一篇

猜你喜欢

热点阅读