Search code examples
djangoconnection

Using the URLconf defined in crp1.urls, Django tried these URL patterns,admin/ The current path, register.html, didn't match any of these.**


Page not found error in django.
I got 404 error my url is http://127.0.0.1:8000/register.html and error is

Using the URLconf defined in crp1.urls, Django tried these URL patterns, in this order: [name='index'] register [name='register'] admin/ The current path, register.html, didn't match any of these.

I created one folder for projects in that I started reglog application in crp1 folder and index page I am getting but when I click form index.html for sign up page I get above error.
In my application url file I coded:

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

in views file:

def index(request):
     return render(request,'index.html')  
def register(request):
    return render(request,'register.html')

and in my project name crp1 file I write following code in crp1.urls:

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

and in register.html

<a href="register.html"></a> 

Solution

  • Access 127.0.0.1:8000/register (without the .html)

    or change the link to

    <a href="/register"></a>