I have a project whose root url conf content is :
from django.conf.urls import patterns, include, url
import funnytest
urlpatterns = patterns(
url(r'^funnytest/', include('funnytest.urls')),
url(r'^helloworld/', funnytest.views.hello),
)
funnytest is an app of this project ,In funnytest I write a module urls.py to configure request of this app :
from django.conf.urls import patterns, include, url
from views import *
urlpatterns = patterns(
url(r'^hello/$', hello),
)
AS I visit localhost/funnytest/hello/ there return a dispath error which say that there has no such pattern
While I visit localhost/helloworld , it works well.
为什么呢,应该如何配置~
If you look at the definition of the patterns function:
You’ll see that patterns takes an argument ‘prefix’ before the list of url patterns.
Try the following in both files: Add an empty string as the first argument to patterns.