问题
I getting a 'Reverse for 'views.mainPage' with arguments '()' and keyword arguments '{}' not found.'
mainPage method in /django_crm/crm/views.py
@login_required
def mainPage(request):
variables = RequestContext(request, {
'user': request.user,
})
return render_to_response('mainPage.html', variables)
and /django_crm/django_crm/templates/mainPage.html
<html>
<head>
<title>test</title>
</head>
<body>
{% url 'crm.views.mainPage' %}
</body>
</html>
Error...
Reverse for ''crm.views.mainPage'' with arguments '()' and keyword arguments '{}' not found.
回答1:
{% load url from future %}
if you are using django < 1.5
Or
Remove quotes from url tag.
Changed in Django 1.5: The first parameter used not to be quoted, which was inconsistent with other template tags. Since Django 1.5, it is evaluated according to the usual rules: it can be a quoted string or a variable that will be looked up in the context.
来源:https://stackoverflow.com/questions/14452700/i-getting-a-reverse-for-views-mainpage-with-arguments-and-keyword-argume