Speed up development with full-stack environments for every branch.

Learn More

How to perform authentication with Django [Python]

2490 Runs 9095 Views 5662 Copies
Saved

Saved

magicjohnson 10

magicjohnson
published 4 years ago

from django.conf.urls import patterns, include, url

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns('',
    # index page
    url(r'^$', 'app.views.index'),
    # after login user will be redirected to this url
    url(r'^logged_in/$', 'app.views.logged_in'),
    # using default django auth views with custom templates
    url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}),
    url(r'^logout/$', 'django.contrib.auth.views.logout', {'template_name': 'logout.html'}),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    # url(r'^admin/', include(admin.site.urls)),
    
)
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).