django url get方法urlpatterns

时间:2013-03-24 09:30:23

标签: python django url-pattern

找不到页面(404)
请求方法:GET
请求网址:http://chinafhp.sinaapp.com/search/?q=ag

urlpatterns的:

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'web.views.home', name='home'),
    # url(r'^web/', include('web.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:

    url(r'^serach/$',views.serach),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^$',views.home),

    url(r'^movie/([^/]+)/$',views.movieList),
    url(r'^tv/([^/]+)/$',views.tvList),
)

为什么?

2 个答案:

答案 0 :(得分:4)

url(r'^serach/$',views.serach),

应该是

url(r'^search/$',views.search),

答案 1 :(得分:1)

似乎你拼错了搜索这个词,但问题是你正确输入了views.serach,因为django没有抱怨它所以有一个serach视图明确。

因此,如果你想访问你的网址,你会很好:

http://chinafhp.sinaapp.com/serach/?q=ag