I have created a Django application and hosted on local network. when I use http://localhost:8000/klo/ it redirects to the login page and after successful login, it redirects to the home page http://localhost:8000/klo/home/. Same behaviour is observed with local host IP:127/0.0.1:8000.
However when I use the IP addr (172.xx.xx.xx:8000/klo) to connect to the app, login page appears but even after entering the correct credentials the redirect to home page not working but login appears again and again. But the url shown with next value (http://172.xx.xx.xx:8000/accounts/login/?next=/klo/home/)
settings.py includes ALLOWED_HOSTS = ['*'] LOGIN_REDIRECT_URL = 'klo-home'
project level - urls.py includes path('klo/', include('users.urls')),
application name - users
users application level - urls.py includes path('home/', views.klo_home, name="klo-home"),
users application level - views.py @login_required(login_url="/accounts/login/") def klo_home(request): return render(request, 'registration/klo_home.html')
Need to know what stops the app from redirecting to klo-home page after valid login only when using IP addr (http://<ip_addr:8000/klo/>) for accessing the app.