B
B
Boldy2014-11-18 15:03:57
Django
Boldy, 2014-11-18 15:03:57

How to connect login form to django?

I want to see the login/password authorization form by accessing 127.0.0.1:8000/login. What to write where? I looked at the documentation, but found only the backend. Did you search badly?

INSTALLED_APPS = (
    'grappelli',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.flatpages',
    'django.contrib.sites'
    ...
)
MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anatoly Scherbakov, 2014-11-18
@Boldy

See documentation: https://docs.djangoproject.com/en/1.7/topics/auth/...
Django already contains the view you need. You need to:
- Set the path to it in urls.py
- Make an HTML template for it

A
Andrey K, 2014-11-18
@mututunus

urls.py

<form method="post" action=".">
    {% csrf_token %}
    {{ form.as_p }}
    <input type="submit">
</form>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question