The requested url was not found on this django server

I follow the youtube tutorial and get an error message ...

getting an error

The requested URL /hello was not found on this server. 

website / urls.py

 urlpatterns = patterns('', url(r'^hello/$', article.views.hello), ... ) 

Article / 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) 

website / settings.py

 INSTALLED_APPS = ( ... 'article', ) 
+5
source share
1 answer

The request URL /hello does not have a trailing slash ( / ). Can you copy url / template by adding ? :

 url(r'^hello/?$', article.views.hello), 
+5
source

Source: https://habr.com/ru/post/1204963/


All Articles