Tuesday, June 26, 2018

Re: NoReverseMatch at / ' homepage' is not a registered namespace

ok, and that has nothing to do with what I mentioned in my original response.

this has nothing to do with your templates and how they're structured.  it has everything to do with the way your urls are defined

On Tuesday, June 26, 2018 at 10:38:15 AM UTC-4, Tim Vogt wrote:
I am building my django app from base.html and with child themes

and get these errors:

any help woud be appreciated.

Tim


NoReverseMatch at /
' homepage' is not a registered namespace
Request Method:        GET
Request URL:        http://localhost:8000/
Django Version:        2.0.6
Exception Type:        NoReverseMatch
Exception Value:        
' homepage' is not a registered namespace
Exception Location:        /Users/timvogt/newdjango/lib/python3.6/site-packages/django/urls/base.py in reverse, line 86
Python Executable:        /Users/timvogt/newdjango/bin/python3
Python Version:        3.6.5
Python Path:        
['/Users/timvogt/coolapp',
 '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip',
 '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6',
 '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload',
 '/Users/timvogt/newdjango/lib/python3.6/site-packages']
Server time:        Mon, 25 Jun 2018 20:46:07 +0000
Error during template rendering

In template /Users/timvogt/coolapp/homepage/templates/homepage/base.html, error at line 2
' homepage' is not a registered namespace
1        <p>
2            <a href='{% url ' homepage:index ' %}'>main</a>
3            <a href='{% url ' homepage:topics ' %}'>topics</a> {% block content %} {% endblock content %}

vieuws.py
from django.shortcuts import render

from .models import Topic
def index(request):
    """the homepage for the homepage"""
    return render(request, 'homepage/index.html')

def topics(request):
    """show all topics"""
    topics = Topic.objects.order_by('date_added')
    context = {'topics': topics}
    return render(request, 'homepage/topics.html', context)
# Create your views here.




base.html
<p>
    <a href='{% url ' homepage:index ' %}'>main</a>
    <a href='{% url ' homepage:topics ' %}'>topics</a> {% block content %} {% endblock content %}

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/35105c58-7543-46b7-9b93-c3c9d1a87547%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment