django URLconf current path didn't match

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

django URLconf current path didn't match

Usman Gill

Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:

polls/ [name='index']
admin/

The current path, polls/, didn't match any of these.


My code is... from (app)polls urls.py


from django.urls import path
from . import views


urlpatterns = [
    path('', views.index, name='index'),
]

from (project)mysite urls.py

from django.urls import include, path
from django.contrib import admin


urlpatterns = [
    path('polls/', include('polls.urls')),
    path('admin/', admin.site.urls),

]

from views.py project file

from django.shortcuts import render
from django.http import HttpResponse

def index(request):
    return HttpResponse("Hello world, you are at the polls 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 [hidden email].
To post to this group, send email to [hidden email].
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/165f234a-ede8-43a2-8bcb-993da74f4cab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: django URLconf current path didn't match

Jason Johns
and you're getting this from the URL localhost:8000/polls/ ?

On Saturday, March 10, 2018 at 8:31:34 AM UTC-5, Usman Gill wrote:

Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:

polls/ [name='index']
admin/

The current path, polls/, didn't match any of these.


My code is... from (app)polls urls.py


from django.urls import path
from . import views


urlpatterns = [
    path('', views.index, name='index'),
]

from (project)mysite urls.py

from django.urls import include, path
from django.contrib import admin


urlpatterns = [
    path('polls/', include('polls.urls')),
    path('admin/', admin.site.urls),

]

from views.py project file

from django.shortcuts import render
from django.http import HttpResponse

def index(request):
    return HttpResponse("Hello world, you are at the polls 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 [hidden email].
To post to this group, send email to [hidden email].
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/5ac32509-5517-4e33-ab78-7ad86ec9c54e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.