NoReverseMatch at / ' homepage' is not a registered namespace

72 views
Skip to first unread message

Tim Vogt (Tim Vogt)

unread,
Jun 25, 2018, 6:17:26 PM6/25/18
to django...@googlegroups.com
I am building my django app from bas.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 %}

Jason

unread,
Jun 25, 2018, 7:49:40 PM6/25/18
to Django users
Check the docs at https://docs.djangoproject.com/en/2.0/topics/http/urls/#id5, and show your urls.py files.  anything missing from there?

Tim Vogt

unread,
Jun 26, 2018, 10:38:15 AM6/26/18
to Django users
I am building my django app from base.html and with child themes

Jason

unread,
Jun 26, 2018, 1:10:35 PM6/26/18
to Django users
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

pranay reddy

unread,
Jun 27, 2018, 1:54:36 AM6/27/18
to Django users
Incorrect syntax used
Correction
Views.py:

from .models import Topic
def index(request):
"""the homepage for the homepage"""

return render(request, 'homepage/index.html', name="something")

Base.html:

<a href='{% url ' something ' %}'>main</a>

Follow the same process for every view and template


Sent via the BlackBerry Hub for Android

  Original Message  
From: timt...@gmail.com
Sent: June 26, 2018 20:08
To: django...@googlegroups.com
Reply-to: django...@googlegroups.com
Subject: NoReverseMatch at / ' homepage' is not a registered namespace

and get these errors:

Tim

--
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...@googlegroups.com.
To post to this group, send email to django...@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/588239f0-581b-4764-bd96-51d23faa5ab3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nelson Varela

unread,
Jun 29, 2018, 9:25:04 AM6/29/18
to Django users
You don't have of did not configure the urls.py
there should be an url which points to the view

Nikesh Tandel

unread,
Jun 29, 2018, 9:45:33 AM6/29/18
to django...@googlegroups.com
"{% url ' homepage:index ' %}"

On Fri, Jun 29, 2018 at 2:25 PM Nelson Varela <nelson....@gmail.com> wrote:
You don't have of did not configure the urls.py
there should be an url which points to the view

--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages