在此服务器django上找不到请求的URL

bez*_*oon 5 python regex django django-urls

我正在关注youtube教程,并收到错误...

得到一个错误

The requested URL /hello was not found on this server.
Run Code Online (Sandbox Code Playgroud)

网站/ urls.py

urlpatterns = patterns('',
    url(r'^hello/$', article.views.hello),
    ...
)
Run Code Online (Sandbox Code Playgroud)

文/ 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)
Run Code Online (Sandbox Code Playgroud)

网站/ settings.py

INSTALLED_APPS = (
    ...
    'article',
)
Run Code Online (Sandbox Code Playgroud)

fal*_*tru 5

请求网址/hello没有尾部斜杠(/).您可以/通过附加?以下选项使URL模式匹配:

url(r'^hello/?$', article.views.hello),
Run Code Online (Sandbox Code Playgroud)