Python 我无法登录到Django用户凭据
我将遵循 我已经在一步一步地关注那个网站,现在我已经达到了登录模板阶段,但我有一些问题,我不能登录,Django告诉我“你的用户名和密码不匹配。”。请再试一次即使我使用有效凭证登录 my login.htmlPython 我无法登录到Django用户凭据,python,html,django,Python,Html,Django,我将遵循 我已经在一步一步地关注那个网站,现在我已经达到了登录模板阶段,但我有一些问题,我不能登录,Django告诉我“你的用户名和密码不匹配。”。请再试一次即使我使用有效凭证登录 my login.html {% load static %} <html> <head> <title>Login Page</title> <link rel="stylesheet" type="text/css" href="{% static
{% load static %}
<html>
<head>
<title>Login Page</title>
<link rel="stylesheet" type="text/css" href="{% static 'style login.css' %}">
</head>
<body>
{% if form.errors %}
<p>Your username and password didnt match. Please try again.</p>
{% endif %}
{% if next %}
{% if user.is_authenticated %}
<p>Your account doesnt have access to this page. To proceed,
please login with an account that has access.</p>
{% else %}
<p>Please login to see this page.</p>
{% endif %}
{% endif %}
<div class="loginbox">
<img src="{% static 'avatar.png' %}" class="avatar">
<h1>Login Here</h1>
<form method="post" action="{% url 'login'%}">
{% csrf_token %}
<p>Username</p>
<input type="text" name="" placeholder="Enter Username">
<p>Password</p>
<input type="password" name="" placeholder="Enter Password">
<input type="submit" name="" value="{{ next }}">
<a href="">Dont have an account</a>
</form>
</div>
</body>
</html>
{%load static%}
登录页面
{%if form.errors%}
您的用户名和密码不匹配。请再试一次
{%endif%}
{%if next%}
{%if user.u经过身份验证%}
您的帐户无权访问此页面。继续,
请使用具有访问权限的帐户登录
{%else%}
请登录以查看此页面
{%endif%}
{%endif%}
在这里登录
{%csrf_令牌%}
用户名
密码
您还需要共享登录代码。另外,请注意您的
和
标记不正确。头部和身体需要分开。例如:
。标题
和链接
需要保留在头部,其余部分需要保留在身体中。我真的很抱歉,汤姆,那是我的错,我已经修复了。你如何在你的html@ngawang13嘿,它的工作,我刚刚意识到我必须写{{form.username}}和{{form.password}}谢谢,你也需要分享登录代码。另外,请注意您的
和
标记不正确。头部和身体需要分开。例如:
。标题
和链接
需要保留在头部,其余部分需要保留在身体中。我真的很抱歉,汤姆,那是我的错,我已经修复了。你如何在你的html@ngawang13嘿,它的工作,我刚刚意识到我必须写{{form.username}和{{form.password}}谢谢兄弟