【发布时间】:2013-12-07 13:14:42
【问题描述】:
这些是我的文件:
urls.py:
from django.conf.urls import patterns, include, url
from eiris_wipro.views import *
urlpatterns = patterns('',
(r'^hello/$',hello),
(r'^articles/(?P<collection>)/$', restusers),
)
views.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 错误!!
我应该遗漏一些非常基本的东西。那可能是什么?
【问题讨论】:
-
您的 urlpatterns 不包括
/smthn/但/articles/smthn/ -
@alko:哎呀错字了。谢谢。固定
标签: python django django-urls