学习Django框架时,创建一个引擎及索引时报错,具体报错如下:

执行命令:

python3 manage.py rebuild_index

报如下错误:

......(前面一堆报错)
File "/home/python/Django/test6/test6/urls.py", line 20, in <module>
  url(r'^admin/', include(admin.site.urls)),
 File "/home/python/.virtualenvs/py_django/lib/python3.6/site-packages/django/urls/conf.py", line 27, in include
  'provide the namespace argument to include() instead.' % len(arg)
django.core.exceptions.ImproperlyConfigured: Passing a 3-tuple to include() is not supported. Pass a 2-tuple containing the list of patterns and app_name, and provide the namespace argument to include() instead.

可以看到以上报错中第2行代码:

url(r'^admin/', include(admin.site.urls)),

网上查询后,将项目路径下的urls.py文件的这一行代码改为:

url(r'^admin/', admin.site.urls),

再次执行python3 manage.py rebuild_index,不再报错.

Django之创建引擎索引报错及解决详解

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!