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 %}
No comments:
Post a Comment