Django NoReverseMatch注册应用程序

Django NoReverseMatch注册应用程序,django,web,Django,Web,我安装了名为registration的Django应用程序。我设置了模板,添加到url和查看文件,一切都很顺利。现在,我在注销后重新登录系统时遇到问题(以前从未发生过),我从浏览器中清除cookies和浏览历史记录(我尝试了多个cookies以查看是否存在问题),然后进入“/registration/login/”并键入信息,我就可以登录了。我点击我的注销按钮,它会让我注销一切正常。问题是,当我第二次登录时,我会进入“/registration/login/”并在表单中键入我的信息,然后提交并获

我安装了名为registration的Django应用程序。我设置了模板,添加到url和查看文件,一切都很顺利。现在,我在注销后重新登录系统时遇到问题(以前从未发生过),我从浏览器中清除cookies和浏览历史记录(我尝试了多个cookies以查看是否存在问题),然后进入“/registration/login/”并键入信息,我就可以登录了。我点击我的注销按钮,它会让我注销一切正常。问题是,当我第二次登录时,我会进入“/registration/login/”并在表单中键入我的信息,然后提交并获取

NoReverseMatch at /registration/login/
Reverse for '' with arguments '()' and keyword arguments '{}' not found.
Request Method: POST
Request URL:    http://genie:8181/registration/login/
Django Version: 1.5.2
Exception Type: NoReverseMatch
Exception Value:    
Reverse for '' with arguments '()' and keyword arguments '{}' not found.
Exception Location: /usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py     in _reverse_with_prefix, line 416
Python Executable:  /usr/bin/python
Python Version: 2.7.3
Python Path:    
['/var/www/RegCal',
 '/usr/local/lib/python2.7/dist-packages/South-0.8.2-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/distribute-0.7.3-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/setuptools-1.1.6-py2.7.egg',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages']
Server time:    Tue, 8 Oct 2013 17:18:11 -0500
Traceback Switch to copy-and-paste view

/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py in get_response
                    response = callback(request, *callback_args, **callback_kwargs) ...
 ▶ Local vars
 /usr/local/lib/python2.7/dist-packages/django/views/decorators/debug.py in      sensitive_post_parameters_wrapper
          return view(request, *args, **kwargs) ...
现在,这些错误通常会给出一个“与“”相反”的名称以及行号,这通常是一个URL问题。我不明白的是,如果我可以访问这个URL,为什么表单不会发布到它。提前感谢任何提示或提示让我知道你需要看到什么,我会上传它

用于登录的模板文件 {%extends'base.html%}

{% block title %} | Please login{% endblock title %}

{% block content %}
    {% if forms.errors %}
        <p>Sorry, that's not a valid username or password</p>
    {% endif %}
    <div class="row-fluid">
        <form id="login_small" class="span6" action="{{ app_path }}" method="post" >{% csrf_token %}
            <div class="span4 pic"></div>

            <div class="span8">
                <span></span>
                <input type="text" name="username" value="Username" id="username">
                <input type="password" name="password" value="password" id="password">
                <input type="submit" value="login" class="submit_but" />
            </div>
        </form>
    </div>

{% endblock content %}
{%block title%}请登录{%endblock title%}
{%block content%}
{%if forms.errors%}
抱歉,这不是有效的用户名或密码

{%endif%} {%csrf_令牌%} {%endblock内容%}
请注意,我已经尝试更改{{app_path}},但没有改变任何东西,我仍然得到相同的错误

URL模式文件:

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('',
    #Get urls from the userprofile app
    url(r'^account/', include('userprofile.urls')),

    #URL Patterns for the registration apps
    url(r'^registration/', include('registration.backends.default.urls')),

    #Site Admin URL Patterns
    url(r'^admin/', include(admin.site.urls)),
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    #Day URL Patterns
    url(r'^view/day/(\d+)/(\d+)/(\d+)/$', 'courseCalendar.views.day'),
    url(r'^view/day$', 'courseCalendar.views.day'),

    #Month URL Patterns
    url(r'^view/month$', 'courseCalendar.views.month'),
    url(r'^view/month/(?P<year>\d{4})/(?P<month>\d{1,2})$', 'courseCalendar.views.month'),
    url(r'^view/month/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<change>\w+)$', 'courseCalendar.views.month'),

    #Year URL Patterns
    url(r"^view/year/(?P<year>\d+)$", 'courseCalendar.views.year'),

    #Course Edit Patterns
    url(r"^edit/course/(?P<courseID>\d+)$", 'courseCalendar.views.courseEdit'),
    url(r"^edit/course$", 'courseCalendar.views.courseEdit'),

    #Enroll Student Page
    url(r"^enroll/(?P<courseID>\d+)/(?P<userID>\d+)$", 'courseCalendar.views.enroll'),

    #Search through existing courses
    url(r"^search/$", 'courseCalendar.views.courseSearch'),

    #Root Directory Pattern
    url(r'', 'courseCalendar.views.year'),
)
从django.conf.url导入模式,包括,url
#取消注释下两行以启用管理员:
从django.contrib导入管理
admin.autodiscover()
urlpatterns=模式(“”,
#从userprofile应用程序获取URL
url(r“^account/”,包括('userprofile.url'),
#注册应用程序的URL模式
url(r“^registration/”,包括('registration.backends.default.url'),
#站点管理URL模式
url(r“^admin/”,包括(admin.site.url)),
url(r“^admin/doc/”,包括('django.contrib.admindocs.url'),
#日URL模式
url(r“^view/day/(\d+)/(\d+)/(\d+)/$”,“courseCalendar.views.day”),
url(r“^view/day$”、“courseCalendar.views.day”),
#月份URL模式
url(r“^view/month$”、“courseCalendar.views.month”),
url(r'^view/month/(?P\d{4})/(?P\d{1,2})$,'courseCalendar.views.month'),
url(r'^view/month/(?P\d{4})/(?P\d{1,2})/(?P\w+)$,'courseCalendar.views.month'),
#年份URL模式
url(r“^view/year/(?P\d+)$”,“courseCalendar.views.year”),
#课程编辑模式
url(r“^edit/course/(?P\d+)$”,“courseCalendar.views.courseEdit”),
url(r“^edit/course$”,“courseCalendar.views.courseEdit”),
#注册学生页面
url(r“^enroll/(?P\d+)/(?P\d+)$”,“courseCalendar.views.enroll”),
#搜索现有课程
url(r“^search/$”,“courseCalendar.views.courseSearch”),
#根目录模式
url(r'','courseCalendar.views.year'),
)

我觉得这样做很愚蠢。我出现此错误的原因是因为我登录了\u重定向\u URL=''。我在允许我登录的URL的下一个参数中输入了不同的参数,这就是问题所在。起初,我认为是我的url文件没有捕捉到根目录的请求,但这没有意义,因为我可以点击根url并获得一个页面。我决定浏览一下设置页面,我发现这行代码被修改了,我们恢复了正常

好吧,它似乎正在尝试反转一个空序列,因此
'
,发布您的模板我尝试将其从app_path更改为“/registration/login/”但是它没有改变。你能添加你的URL吗?py?我以前从来没有遇到过这个问题,我可以通过键入URL来定期访问URL,但是当表单发布时,我会在没有参数的情况下得到这个错误。