why is a text not displayed?

18 views
Skip to first unread message

nexusy...@gmail.com

unread,
Dec 21, 2017, 7:43:10 AM12/21/17
to Django users
I made this along a tutorial.
However 
"Hello, world. You're at the blog index."
is not displayed.
"""blog/views.py"""
from django.http import HttpResponse


def index(request):
   
return HttpResponse("Hello, world. You're at the blog index.")
"""blog/urls"""
from django.urls import include, path
from django.contrib import admin
from . import views

urlpatterns
= [
    path
('', views.index, name='index'),
    path('blog/', include('blog.urls')),
    path('admin/', admin.site.urls),
]


pradam programmer

unread,
Dec 21, 2017, 7:47:13 AM12/21/17
to django...@googlegroups.com
Change to this:
path('^$', views.index, name='index'),

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/985ce4a9-1288-40fa-9aea-6510f6c84d6a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Julio Biason

unread,
Dec 21, 2017, 7:48:50 AM12/21/17
to django...@googlegroups.com
Hello,

Did you remembered to include this urls.py in the project urls.py? This looks like your app internal URLs, but you still need to tell the whole project that it should include these URLs into it (with, maybe, a prefix).
Reply all
Reply to author
Forward
0 new messages