Performing system checks…
django.core.exceptions.ImproperlyConfigured: The included URLconf ‘<module ‘you.urls’ from ‘/home/zw/project_practice/wolove/you/urls.py’>’ does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.
from django.conf.urls import url, include from django.contrib import admin urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^you/',include('you.urls')), ]发现当引入include就会出现运行错误,
# url(r'^you/',include('you.urls')),将其注释掉又能成功运行。
问题解决办法:
这是因为,在您的应用中没有书写urls代码及视图函数,把它们写上就ok了。 如:子应用下urls.py:
from django.conf.urls import url, include from you import views urlpatterns = [ url(r'^index/',views.index), ]子应用视图iews.py:
from django.shortcuts import render # Create your views here. def index(request): return render(request,'index.html')再去运行你就发现,自己有多傻了!希望对你有帮助,毕竟我也犯了这么傻的错误