hello ...
your code is good
but you forgot to put comma after second path in urls.py
urlpatterns = [
path('admin/', admin.site.urls),
path('first_app/', include('first_app.urls')),
]
On Saturday, March 23, 2019 at 6:08:24 PM UTC+2, The Aryas wrote:
>
> Hey Guys, I am facing problem on django url mapping, I did exactly what my
> couse said and copied the code text exactly,but it throws the error:-
>
>
> Page not found (404)
> Request Method: GET
> Request URL: http://127.0.0.1:8000/index
>
> Using the URLconf defined in protwo.urls, Django tried these URL
> patterns, in this order:
>
> 1. admin/
> 2. [name='index']
>
> The current path, index, didn't match any of these.
>
> You're seeing this error because you have DEBUG = True in your Django
> settings file. Change that to False, and Django will display a standard
> 404 page.
>
>
>
>
> ##The code I written in my project are;:-
>
> --------------------------------------------------------------------
>
> <urls.py-first_project>
>
>
> from django.contrib import admin
>
> from django.urls import path, include
>
>
> urlpatterns = [
>
> path('admin/', admin.site.urls),
>
> path('first_app/', include('first_app.urls'))
>
>
> ]
>
> ----------------------------------------------------------------------
>
> -----------------------------------------------------------------------
>
>
> <urls.py-first_app>
>
>
> from django.contrib import admin
>
> from django.urls import path
>
> from . import views
>
> urlpatterns = [
>
> path('index/', views.index, name="index"),
>
> ]
>
> -------------------------------------------------------------------------
> --------------------------------------------------------------------------
> <views.py>
>
> from django.shortcuts import render
> from django.http import HttpResponse
>
> # Create your views here.
> def index(request):
> return HttpResponse("Hello World")
>
> ----------------------------------------------------------------------------
>
> ----------------------------------------------------------------------------
>
> <settings.py>
>
> INSTALLED_APPS = [
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'first_app'
> ]
>
>
> -------------------------------------------------------------------------------
>
> I dont know what to do , I could not find the error plz assist me, I am a
> begginer to this cousre,
> Thank You!!
>
>
--
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 [email protected].
To post to this group, send email to [email protected].
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/a526e914-6770-469c-9737-42e55ecba052%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.