首页 > 开发 > Python > 正文

django的url配置求教~为什么无法include

2017-09-06 19:39:08  来源:网友分享

我有一个project 跟目录的root url conf 设置内容为:

----------------------------------------------------------

from django.conf.urls import patterns, include, urlimport funnytesturlpatterns = patterns(url(r'^funnytest/', include('funnytest.urls')),url(r'^helloworld/', funnytest.views.hello),)

-----------------------------------------------------------

其中funnytest是其中一个app,funnytest 目录下设置了一个Urls, 内容为:
------------------

from django.conf.urls import patterns, include, urlfrom views import *urlpatterns = patterns(url(r'^hello/$', hello),)

-------------------

我访问 localhost/funnytest/hello/ 会报错,表示urls 中没有匹配的配置
但是访问localhost/helloworld 是可以访问到view hello 的

为什么呢,应该如何配置~

解决方案