404 Error Python Django

Asked

Viewed 442 times

2

That’s the mistake I’m having:

inserir a descrição da imagem aqui

As you can see in the URLS list the number 8 is equal to the "Current url" given below.

My url list:

from django.conf.urls import include, url
from django.contrib import admin
from principal.views import IndexView, LogOut, RedirQuiz

urlpatterns = [
    url('', include('social.apps.django_app.urls', namespace='social')),
    url(r'^admin/', admin.site.urls),    
    url(r'^$', IndexView),
    url(r'^sair/$', LogOut),
    url(r'^Quiz/$', RedirQuiz),
]

My view:

from django.shortcuts import render
from django.http import HttpResponse
from django.views.generic import TemplateView
from django.shortcuts import render, redirect
from django.contrib.auth import logout
from django.template import loader

def IndexView(request):
    template = 'index.html'
    return render(request, template)



def LogOut(request):
    logout(request)
    return redirect('/')



def RedirQuiz(request):
    if request.method == 'POST':
        return render('Quizz.html')
    return HttpResponse(request(render))

What I want to do is simply redirect a page after user authentication. However, even creating the HTML file to refer to me, it know where the file is, use the correct link, get this error.

  • You’re at the Stackoverflow in Portuguese, if you do not translate your question, it will be closed. | You’re in Stackoverflow in Portuguese, if you don’t Translate your Question, it’ll be closed.

  • Translated......

1 answer

4

Change

 url(r'^Quiz/$', RedirQuiz),

for

 url(r'Quiz/$', RedirQuiz),

Or

url(r'complete/facebook/Quiz/?$),

The characters ^ and $ are special.

The first( ) says that the combination must START and the second ($) must END.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.