我无法迁移到以下文件?

I am not able to make migrations to the following file?

我正在尝试创建以下 models.py 代码的 迁移 但出现以下错误 ???(我正在从 [= 学习网络开发12=]) 谁能帮我解决这个错误,因为我对 django、sqlite 以及 Web 开发知之甚少。

    from django.db import models
    class Flight(models.Model):
        origin = models.CharField(max_length=64)
        destination = models.CharField(max_length=64)
        duration = models.IntegerField()

错误如下:

Traceback (most recent call last):
  File "C:\Users\Dell\Desktop\Books\Programming\Web Devlopment\Lecture-4\airline\manage.py", line 22, in <module>
    main()
  File "C:\Users\Dell\Desktop\Books\Programming\Web Devlopment\Lecture-4\airline\manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\base.py", line 414, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\base.py", line 455, in execute
    self.check()
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\base.py", line 487, in check
    all_issues = checks.run_checks(
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\checks\registry.py", line 88, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\checks\urls.py", line 14, in check_url_config
    return check_resolver(resolver)
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\checks\urls.py", line 24, in check_resolver
    return check_method()
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python310\lib\site-packages\django\urls\resolvers.py", line 480, in check
    for pattern in self.url_patterns:
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\functional.py", line 49, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python310\lib\site-packages\django\urls\resolvers.py", line 696, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\functional.py", line 49, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python310\lib\site-packages\django\urls\resolvers.py", line 689, in urlconf_module
    return import_module(self.urlconf_name)
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\Dell\Desktop\Books\Programming\Web Devlopment\Lecture-4\airline\airline\urls.py", line 22, in <module>
    path('flights/', include('flights.urls') ),
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python310\lib\xml\etree\ElementInclude.py", line 128, in include
    _include(elem, loader, base_url, max_depth, set())
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python310\lib\xml\etree\ElementInclude.py", line 136, in _include
    if e.tag == XINCLUDE_INCLUDE:
AttributeError: 'str' object has no attribute 'tag'

您正在从错误的 module.Probably 从 xml.etree.ElementInclude

导入 include

所以改变

from xml.etree.ElementInclude import include

from django.urls import include

在您的 airline/urls.py 文件中。