0

Django noob 在这里试图让登录工作。我正在尝试加载我的 login.html 页面,但由于某种原因,我收到以下错误:

/login/ 处的 ImportError 没有名为视图的模块

并将此代码显示为触发错误,错误位于 url 函数的第 5 行:

1   {% if form.errors %}
2   <p>Your username and password didn't match. Please try again.</p>
3   {% endif %}
4   
5   <form method="post" action="{% url 'django.contrib.auth.views.login' %}">
6   {% csrf_token %}
7   <table>
8   <tr>
9       <td>{{ form.username.label_tag }}</td>
10      <td>{{ form.username }}</td>
11  </tr>
12  <tr>
13      <td>{{ form.password.label_tag }}</td>
14      <td>{{ form.password }}</td>
15  </tr>

知道发生了什么吗?我必须在某处导入视图吗?

4

1 回答 1

0

FIXED IT! Turns out I had screwed up my urls.py file and had a nonexistent view linked to in another url. I got rid of that and it worked

于 2012-12-01T00:18:33.343 回答