django 名称错误:名称'Include'未定义[已关闭]

cwtwac6a  于 2023-06-25  发布在  Go
关注(0)|答案(1)|浏览(127)

**已关闭。**此问题为not reproducible or was caused by typos。目前不接受答复。

此问题是由打印错误或无法再重现的问题引起的。虽然类似的问题在这里可能是on-topic,但这个问题的解决方式不太可能帮助未来的读者。
8天前关闭
Improve this question
我目前正在开发一个移动的应用程序与Django作为后端(我是一个初学者),但我有一个问题与Python:因为我创建了我的应用程序,我不能运行% python manage.py makemigrations并得到错误

Traceback (most recent call last):
  File "/Users/neddy-glenatege/PycharmProjects/pythonProject/pythonProject/SchoolApp/APISchool/manage.py", line 22, in <module>
    main()
  File "/Users/neddy-glenatege/PycharmProjects/pythonProject/pythonProject/SchoolApp/APISchool/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/Users/neddy-glenatege/Library/Python/3.9/lib/python/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/Users/neddy-glenatege/Library/Python/3.9/lib/python/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/neddy-glenatege/Library/Python/3.9/lib/python/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/neddy-glenatege/Library/Python/3.9/lib/python/site-packages/django/core/management/base.py", line 453, in execute
    self.check()
  File "/Users/neddy-glenatege/Library/Python/3.9/lib/python/site-packages/django/core/management/base.py", line 485, in check
    all_issues = checks.run_checks(
  File "/Users/neddy-glenatege/Library/Python/3.9/lib/python/site-packages/django/core/checks/registry.py", line 88, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "/Users/neddy-glenatege/Library/Python/3.9/lib/python/site-packages/django/core/checks/urls.py", line 14, in check_url_config
    return check_resolver(resolver)
  File "/Users/neddy-glenatege/Library/Python/3.9/lib/python/site-packages/django/core/checks/urls.py", line 24, in check_resolver
    return check_method()
  File "/Users/neddy-glenatege/Library/Python/3.9/lib/python/site-packages/django/urls/resolvers.py", line 494, in check
    for pattern in self.url_patterns:
  File "/Users/neddy-glenatege/Library/Python/3.9/lib/python/site-packages/django/utils/functional.py", line 57, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/neddy-glenatege/Library/Python/3.9/lib/python/site-packages/django/urls/resolvers.py", line 715, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/Users/neddy-glenatege/Library/Python/3.9/lib/python/site-packages/django/utils/functional.py", line 57, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/neddy-glenatege/Library/Python/3.9/lib/python/site-packages/django/urls/resolvers.py", line 708, in urlconf_module
    return import_module(self.urlconf_name)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/Users/neddy-glenatege/PycharmProjects/pythonProject/pythonProject/SchoolApp/APISchool/APISchool/urls.py", line 8, in <module>
    path('', Include('api.urls')),
NameError: name 'Include' is not defined

我正在使用Python -v 4.2
并预计

Migration for "school":
   school\migration\0001_initial.py`enter code here`
   - Create model Article
deikduxw

deikduxw1#

变更

# ...
    path('', Include('api.urls')),
# ...

from django.urls import include
# ...
    path('', include('api.urls')),
# ...

include没有大写“I”/“i”

相关问题