Why “accounts/login/?next=/” is coming in url of Django on local development server ? | Way to remove “accounts/login/?next=/” from the url .

What is issue?

As you could see , in below figure , “accounts/login/?next=/” has come in URL , In this case , on whatever path you call here, will go through “accounts/login/?next=/” in the URL ,We have to remove this from URL.

Two ways to remove “accounts/login/?next=/” from URL.

1st Way-

1-Open your views.py file of your Django Project.

2-Remove “LoginRequiredMixin” , which is passed in Class present in views.py file.

3-Now run your , Development Server , your issue is resolved now.

2nd Way-

1-Open urls.py file , of your Django Project .

2-Add

path('admin/', admin.site.urls), in the urlpatterns of the Project.

3-Now , We have to create superuser , to create superuser, give the command –

 python manage.py createsuperuser

Now , give the username & password to create superuser.

4-Now, run the python development server by command –

python manage.py runserver

5- Go on – “http://127.0.0.1:8000/admin” in the URL and login by the userid & password , which you have created recently for superuser.

6- Now , you will encounter , that the issue is solved.

NOTE- This is only for the purpose of local development on local Django development server.