Take the 2-minute tour ×

I have a login form, which needs to be re-directed to the main page once the login is performed but for some reason I get the page not found error & it gets re-directed to the below page instead of main page.

Here is the code,


        <title>Django Bookmarks - User Login</title>
        <h1>User Login</h1>
        {% if form.errors %}
            <p>Your username and password didnt match.Please try again.</p>
        {% endif %}
            <p>label for="id_username">Username:</label>
                {{ form.username }}</p>
            <p>label for=id_password>Password:</label>
                {{ form.password}}</p>
            <input type="hidden" name="next" value="/" />


urlpatterns = patterns('',
        (r'^login/$', 'django.contrib.auth.views.login'),
        (r'^logout/$', logout_page),
        (r'^site_media/(?P<path>.*)$', 'django.views.static.serve',{'document_root':site_media}),
        (r'^register/$', register_page),
        (r'^volunteer/$', volunteer_page),
        (r'^save/$', bookmark_save_page),
share|improve this question

1 Answer 1

up vote 6 down vote accepted

Change the LOGIN_REDIRECT_URL value in settings.py to you main page's URL. It defaults to /accounts/profile/ if it doesn't exist.

You can also read the LOGIN_REDIRECT_URL documentation.

share|improve this answer

Your Answer


