'Specifying a namespace in include() without providing an app_name '

问题:

 File "D:\Python34\lib\site-packages\django\urls\conf.py", line 39, in include
    'Specifying a namespace in include() without providing an app_name '
django.core.exceptions.ImproperlyConfigured: Specifying a namespace in include()
 without providing an app_name is not supported. Set the app_name attribute in t
he included module, or pass a 2-tuple containing the list of patterns and app_na
me instead.

  

处理方法:

解决方法,在mysite/urls.py增加app_name='mysite'

 

'''定义mysite的url模式'''
from django.conf.urls import url
from . import views

app_name='mysite'

urlpatterns={
    #主页
    url(r'^$',views.index,name='index')
}

 

  

 


 

posted @ 2018-08-03 11:42  神说:要有黑暗  阅读(414)  评论(0编辑  收藏  举报