网络编程
位置:首页>> 网络编程>> 网络编程>> Django之创建引擎索引报错及解决详解

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

作者:GYT0313  发布时间:2023-06-11 10:55:15 

标签:django,创建,引擎,索引,报错

学习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之创建引擎索引报错及解决详解

来源:https://blog.csdn.net/qq_38038143/article/details/80280260

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com