Python NameError: name 'include' is not defined

Python NameError: name 'include' is not defined

我目前正在使用 Django 框架开发一个网站(我是初学者),但是我遇到了 Python 的问题:因为我已经创建了模板,所以我不能 运行 服务器(堆栈跟踪指向文件 urls.py 中的一行):

<stacktrace>
...
path('apppath/', include('myapp.urls')),
NameError: name 'include' is not defined

我可以从哪里导入 include

根据问题中提供的任何少量信息进行猜测,我认为您可能忘记在 urls.py 文件中添加以下导入。

from django.conf.urls import include