Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python NoReverseMatch at/accounts/signup/django allauth错误_Python_Django_Django Allauth - Fatal编程技术网

Python NoReverseMatch at/accounts/signup/django allauth错误

Python NoReverseMatch at/accounts/signup/django allauth错误,python,django,django-allauth,Python,Django,Django Allauth,我的URL.py中有以下代码: from django.conf.urls import url, include from django.contrib import admin urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^accounts/', include('allauth.urls')), url(r'^profile/', include('userProfile.urls')), ]

我的URL.py中有以下代码:

from django.conf.urls import url, include
from django.contrib import admin

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^accounts/', include('allauth.urls')),
    url(r'^profile/', include('userProfile.urls')),
]
这是userProfile.url.py文件:

from django.conf.urls import url, include
from django.contrib import admin

from .views import (
    profile_user,
)

urlpatterns = [
    url(r'^(?P<id>[0-9]+)/profile/$', profile_user),
]
从django.conf.url导入url,包括
从django.contrib导入管理
从。视图导入(
个人资料(用户),
)
URL模式=[
url(r'^(?P[0-9]+)/profile/$,profile_user),
]
我在/accounts/signup上得到了这个错误。我在某个地方读到,这个问题一定是在url.py文件中,但我不知道为什么,如果有人能帮忙,那就太好了。上次我检查时一切正常,现在出了点问题。多谢各位

我知道错误可能不够清楚,所以我从浏览器复制了整个错误:

NoReverseMatch at /accounts/login/
Reverse for 'index' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
Request Method: GET
Request URL:    http://127.0.0.1:8000/accounts/login/
Django Version: 1.9.5
Exception Type: NoReverseMatch
Exception Value:    
Reverse for 'index' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
Exception Location: C:\Python27\lib\site-packages\django\core\urlresolvers.py in _reverse_with_prefix, line 508
Python Executable:  C:\Python27\python.exe
Python Version: 2.7.11
Python Path:    
['D:\\Programiranje\\Python\\Projekat ISA\\ProjekatRestorani',
 'C:\\WINDOWS\\SYSTEM32\\python27.zip',
 'C:\\Python27\\DLLs',
 'C:\\Python27\\lib',
 'C:\\Python27\\lib\\plat-win',
 'C:\\Python27\\lib\\lib-tk',
 'C:\\Python27',
 'C:\\Python27\\lib\\site-packages']
Server time:    Thu, 19 May 2016 12:03:20 +0000
Error during template rendering

In template C:\Python27\lib\site-packages\allauth\templates\account\login.html, error at line 14
Reverse for 'index' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
4   {% load account socialaccount %}
5   
6   {% block head_title %}{% trans "Sign In" %}{% endblock %}
7   
8   {% block content %}
9   
10  <h1>{% trans "Sign In" %}</h1>
11  
12  {% get_providers as socialaccount_providers %}
13  
14  {% if socialaccount_providers %}
15  <p>{% blocktrans with site.name as site_name %}Please sign in with one
16  of your existing third party accounts. Or, <a href="{{ signup_url }}">sign up</a>
17  for a {{ site_name }} account and sign in below:{% endblocktrans %}</p>
18  
19  <div class="socialaccount_ballot">
20  
21    <ul class="socialaccount_providers">
22      {% include "socialaccount/snippets/provider_list.html" with process="login" %}
23    </ul>
NoReverseMatch at/accounts/login/
未找到参数为“()”且关键字参数为“{}”的“索引”的反转。已尝试0个模式:[]
请求方法:获取
请求URL:http://127.0.0.1:8000/accounts/login/
Django版本:1.9.5
异常类型:NoReverseMatch
异常值:
未找到参数为“()”且关键字参数为“{}”的“索引”的反转。已尝试0个模式:[]
异常位置:C:\Python27\lib\site packages\django\core\urlresolvers.py in_reverse_,带_前缀,第508行
Python可执行文件:C:\Python27\Python.exe
Python版本:2.7.11
Python路径:
['D:\\Programiranje\\Python\\Projekat ISA\\ProjekatRestorani',
'C:\\WINDOWS\\SYSTEM32\\python27.zip',
'C:\\Python27\\DLLs',
'C:\\Python27\\lib',
'C:\\Python27\\lib\\plat win',
'C:\\Python27\\lib\\lib tk',
'C:\\Python27',
'C:\\Python27\\lib\\site包']
服务器时间:2016年5月19日星期四12:03:20+0000
模板呈现期间出错
在模板C:\Python27\lib\site packages\allauth\templates\account\login.html中,第14行出现错误
未找到参数为“()”且关键字参数为“{}”的“索引”的反转。已尝试0个模式:[]
4{%load account socialaccount%}
5.
6{%block head_title%}{%trans“登录”%}{%endblock%}
7.
8{%块内容%}
9
10{%trans“登录”%}
11
12{%get_提供者作为socialaccount_提供者%}
13
14{socialaccount\u提供者%}
15{%blocktrans使用site.name作为site\u name%}请使用一个登录
您现有的第三方账户中的16个。或
17对于{site_name}}帐户,请在下面登录:{%endblocktrans%}

18 19 20 21
    22{%包括带有process=“login”%%的“socialaccount/snippets/provider_list.html” 23
但这不是我的login.html代码。。。这是我在login.html文件中的内容:

{% extends "base.html" %}
{% load i18n %}

{% block content %}
<form method="post" action=".">
  {% csrf_token %} 
  {{ form.as_p }}

  <input type="submit" value="{% trans 'Log in' %}" />
  <input type="hidden" name="next" value="{{ next }}" />
</form>

<p>{% trans "Forgot password" %}? <a href="{% url 'auth_password_reset' %}">{% trans "Reset it" %}</a>!</p>
<p>{% trans "Not member" %}? <a href="{% url 'registration_register' %}">{% trans "Register" %}</a>!</p>
{% endblock %}
{%extends“base.html”%}
{%load i18n%}
{%block content%}
{%csrf_令牌%}
{{form.as_p}}
{%trans“忘记密码”%}

{%trans“不是成员”%}

{%endblock%}

因此,如果我从我的templates文件夹中删除这些文件,并让他为空,那么效果很好。我希望我现在给了你一些有用的信息

问题可能出在您的HTML中。尝试通过添加name='profile'来命名该url的名称空间。如果您有以下内容,请签入HTML

href="{% url 'YourApp:profile' %}"

您应该检查您的url是否有反向匹配。

需要查看
allauth.url
module错误何时出现,是否有堆栈跟踪?是否使用allauth?如果是,为什么在你的模板中没有allauth代码,就像你在没有它的情况下使用它一样?你确定你的login.htmk在templates目录的“account”子目录中吗?