我正在关注youtube教程,并收到错误...
收到错误
The requested URL /hello was not found on this server.
网站/ urls.py
urlpatterns = patterns('',
url(r'^hello/$', article.views.hello),
...
)
文章/ views.py
from django.shortcuts import render
from django.http import HttpResponse
def hello(request):
name = 'mike'
html = '<html><body> sup %s </body></html> ' %name
return HttpRequest(html)
网站/ settings.py
INSTALLED_APPS = (
...
'article',
)
答案 0 :(得分:5)
请求网址/hello
没有尾部斜杠(/
)。您可以选择通过附加/
:
?
匹配
url(r'^hello/?$', article.views.hello),