Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8327127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:59:56+00:00 2026-06-09T00:59:56+00:00

My redirection to a new page is failing with a error, login.html, <html> <head>

  • 0

My redirection to a new page is failing with a error,

login.html,

<html>
    <head>
        <title>Django Bookmarks -User Login</title>
    </head>
    <body>
        <h1>User Login</h1>
        {% if form.errors %}
            <p>Your username and password didn't match</p>
        {% endif %}
        <form method="post" action=".">
            <p><label for="id_username">Username:</label>
                {{ form.username }}</p>
            <p><label for="id_password">Password</label>
                {{ form.password }}</p>
            <input type="hidden" name="text" value="/" />
            <input type="submit" value="login" />
        </form>
    </body>
</html>

urls.py

from django.conf.urls.defaults import patterns, include, url
from bookmarks.views import *

urlpatterns = patterns('',
    (r'^$',main_page),
    (r'^user/(\w+)/$',user_page),
    (r'^login/$','django.contrib.auth.views.login'),

)

error

Error:

Forbidden (403)

CSRF verification failed. Request aborted.
Help

Reason given for failure:
    CSRF cookie not set.

 In general, this can occur when there is a genuine Cross Site Request Forgery, or when Django's CSRF mechanism has not been used correctly. For POST forms, you need to ensure:
•The view function uses RequestContext for the template, instead of Context.
•In the template, there is a {% csrf_token %} template tag inside each POST form that targets an internal URL.
•If you are not using CsrfViewMiddleware, then you must use csrf_protect on any views that use the csrf_token template tag, as well as those that accept the POST data.

settings.py file

LOGIN_URL ='/login/'

LOGIN_REDIRECT_URL = '/login/'

New Error:

Page not found (404)



Request Method:

POST



Request URL:

http://127.0.0.1:8000/login/=%22.%22



 Using the URLconf defined in django_bookmarks.urls, Django tried these URL patterns, in this order: 
1. ^$ 
2. ^user/(\w+)/$ 
3. ^login/$ 

The current URL, login/=".", didn't match any of these
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:59:57+00:00Added an answer on June 9, 2026 at 12:59 am

    I think this makes it quite clear:

    Reason given for failure: CSRF cookie not set.

    In the template, there is a {% csrf_token %} template tag inside each POST form that targets an internal URL.

    You need to incude a CSRF token with your form:

    https://docs.djangoproject.com/en/dev/ref/contrib/csrf/

    <form method="post" action=".">{% csrf_token %}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Redirecting to a new page when a user is using Internet Explorer
I have there lines in my RegisterToutes : routes.MapRoute(Pages3, {url1}/{url2}/{url3}, MVC.Page.RedirectTo(), new { url1
I have modified a website with a redirection to a single page: RewriteCond %{REQUEST_FILENAME}
I'm trying to redirect the user if they login successfully but the code I
When a user is not logged in and tries to access a page that
I am having C function. From the html page, through ajaxcall the request is
I have a CustomeAuthorize action filter that forwards the user to signin page if
I'm trying to submit the page and forward to a new JSP. h:outputlink will
I have created a django app. I have implemented a facebook login along with
I have a page that requires the user to go through several steps, however

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.