简体   繁体   中英

Django throws NoReverseMatch error when the urlconf is not empty?

In my main urlconf, I'm including an app's urlconf:

url(r"^items/$", include("items.urls")),

In items/urls.py I have:

urlpatterns = patterns("",
    url(r"^profile/", ProfileView.as_view(), name="accounts_profile"),
    url(r"^$", DashboardView.as_view(), name="items_home"),
)

The problem is that no matter what I enter to urlconf -- except for r"^$" -- I'm getting a NoReverseMatch error in the template calling one of these urlconfs via eg {% url accounts_profile %} . I've tried with different views from different apps, different urlconf names etc, but no luck. Any ideas?

I'm using Django 1.3.1, FWIW.

Nevermind, I got it -- the problem was with the $ sign in the import statement above, which signified the end of the line. Feeling so silly.:-/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM