Django 404 error in all html templates of second app created in my project

Hello everyone I’ve been in this issue for two days now, and I really hope that someone will help me to understand it in order to continue learning. Django 404 error in all html templates of second app created in my project, help is more then appreciated, and thanks in advance!

1. admin/
2. [name='home']
3. about/ [name='about']
4. jptadmin/ [name='jptadmin']
5. dhadmin_login/ [name='dhadmin_login']
6. login [name='login']
7. ^media/(?P<path>.*)$
8. ^static/(?P<path>.*)$

The current path, `login/`, didn’t match any of these.

views settings of the second app created the one with problem

from django.shortcuts import render

from django.http import HttpResponse

#from django.contrib.admin.views.decorators import staff_member_required


def game_admin(request):
    
    return render(request, 'game_admin/game_admin.html',)


#@staff_member_required( login_url="login.urls")
def login(request):
    # Your view logic here
    return HttpResponse("Just Test"),

urls config on the second app created on project, that is the one that I’m having trouble with

   from django.urls import path
   from . import views


  urlpatterns = [
           path('', views.game_admin, name=""),
           path('login', views.login, name="login"),
   ]

main project urls setting


from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static

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

You’ve defined your path as:

And it’s showing in the error message as:

However, you’re trying to reference it as

Which is not the same. (`“login” != “login/”)

Also, for future reference, please title your topics with only a brief statement of the problem and not including a generic “Please help”.

Additionally, doing something like this:

is not a good idea. You really should define a url component to aid the organization and segregation of your urls.

1 Like

Thanks for you sir for use your knowledge and take your time to help us , it worked as charm. bless you

I got it, next time I’ll be straightforward