Django命名组不匹配

2024-09-30 18:13:15 发布

您现在位置:Python中文网/ 问答频道 /正文

这些是我的文件:

网址.py:

from django.conf.urls import patterns, include, url
from eiris_wipro.views import *   

urlpatterns = patterns('',
                   (r'^hello/$',hello),
                   (r'^articles/(?P<collection>)/$', restusers),
)

视图.py: 从django.http导入HttpResponse

def hello(request):
    return HttpResponse("Hello new world!")

def restusers(request, collection='smthn'):
    print 'Collection', collection
    return HttpResponse(collection)

当我尝试按http://127.0.0.1:8000/articles/smthn/时,我得到了404错误!!你知道吗

我应该错过一些非常基本的东西。那会是什么?你知道吗


Tags: djangofrompyimporthttphelloreturnrequest