Django NoReverseMatch, not a registered namespace -


i have following link in project template:

<li><a id="togglelogin" href= "{% url 'login' %}" onclick="togglelogin();" ><span>login</span></a></li> <!-- login app --> 

the project url is:

url(r'^login/',loginviews.user_login,name='login'), 

the application url is:

url(r'^$',views.user_login,name='user_login'), 

and application view is:

def user_login(request):     """user @ login view """     #     if request.method == 'post':         # first username , password supplied         username = request.post.get('username')         password = request.post.get('password')         # django's built-in authentication function:         user = authenticate(username=username, password=password)         # if have user         if user:             #check account active             if user.is_active:                 # log user in.                 login(request,user)                 # send user page.                 # in case homepage.                 return httpresponseredirect(reverse('index'))             else:                 # if account not active:                 return httpresponse("your account not active.")         else:             print("someone tried login , failed.")             print("they used username: {} , password: {}".format(username,password))             return httpresponse("invalid login details supplied.")     else:         #nothing has been provided username or password.         return render(request, 'login.html', {}) 

but once linked clicked, returns following django error:

noreversematch @ /login/ 'login_app' not registered namespace 

should namespace registered in project url file ?

you're not using "application url" @ all. have defined url entirely in project url (as login), no namespace created. use include link app urls, you're not doing that.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -