Why Nginx add query string ?next= to my django url path

Posted January 6, 2021 515 views

i followed digitalocean tutorial at

my view use @login_required

everythings fine when i start server with command

(env)$ python runserver
(env)$ gunicorn –bind lskweb.wsgi

In final step..
Nginx proxy pass to gunicorn.
but when i logged in , django will redirect to /?next=/home

from central import views as c_view
from django.contrib.auth import views as auth_views
from django.urls import include, path

urlpatterns = [
    path('login/', auth_views.LoginView.as_view(template_name='central/login.html'), name='login'),
    path('logout/', auth_views.LogoutView.as_view(next_page='login'), name='logout'),
    path('home/', c_view.home, name='home'),


def home(request):
    data = {}
    return render(request, 'central/home.html', data)


  <a href="/logout">Logout</a>
  <h3><a href="/mails">Mails</a></h3>
  <h3><a href="/insure">Insure</a></h3>
  <h3><a href="/redbooks">Redbooks</a></h3>
  <h3><a href="/dshop">Dshop</a></h3>


I removed @login_required from def home
Nginx not add query string ?next= yet, but not my purpose
becuse i want to secure my views

this is my django webapp

Thank you.

Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!