0

我基于 pinax-social 的 Django 项目无法加载其中包含{% url home %}的任何页面,并显示如下:

NoReverseMatch at /account/login/
Reverse for 'home' with arguments '()' and keyword arguments '{}' not found.

对 url 进行硬编码可以解决问题,只有主页 ReverseMatch 失败。

这是我的 urls.py:

from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from .views import *
from NEOreka.models import *
from .forms import SignupForm
from django.views.generic.simple import direct_to_template

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns("neo.views",
    url(r"^neo/(?P<neo_id>\d+)/$", "neo_info"),
)

urlpatterns += patterns("",
    url(r"^$", "neo.views.home"),
)
urlpatterns += patterns("", 
    url(r"^admin/", include(admin.site.urls)),
    url(r"^account/signup/$", SignupView.as_view(), name="account_signup"),
    url(r"^account/", include("account.urls")),
    )
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

有人可以告诉我如何解决这个问题吗?

4

1 回答 1

0

好的,我测试了这个,它可以工作。我希望它也能在你身边工作。

 {% url neo.views.home %}
于 2013-03-22T05:48:15.277 回答