Decorator Django

0

Good afternoon, I am implementing the @login_required decorator in my application (which can only be accessed if they are authenticated)

views.py

@login_required(login_url="/usuarios/login")
def index(request):
    return render(request, 'index.html')

urls.py

url(r'^$', index, name='index'),

With the other views I get what I need, but with the index, a 404 error occurs.

I request your help to correct this problem

    
asked by jhon1946 06.07.2017 в 19:46
source

1 answer

0

Thanks to @German Alzate for his collaboration, I worked with the following files:

views.py

@login_required(login_url="/usuarios/login/")
def index(request):
    return render(request,'index.html')

urls.py

url(r'^$', index, name='index'),
    
answered by 09.07.2017 / 21:46
source