Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialcsj
12,678 PointsReverse for 'views.hello_world'
I get this Exception Value: Reverse for 'views.hello_world' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
I can't figure out why, what I've missed. I'm just following along with the course videos, and I can't see a typo. No idea where to look.
From my layout.html
{% load static from staticfiles %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>{% block title %}{% endblock %}</title>
<link rel="stylesheet" href="{% static 'css/layout.css' %}" media="screen" title="stylesheet">
</head>
<body>
<div class="site-container">
<nav>
<a href="{% url 'views.hello_world' %}">Home</a>
</nav>
{% block content %}{% endblock %}
</div>
</body>
</html>
csj
12,678 PointsHi Cheo, sure... Here is a dump of the views.py files. https://mega.nz/#!IEBVBSzZ!VM-V70KM550HmnxV8p0Tjf7Gbv8ZMduLqXMgef-KgrI
alex novickis
34,894 PointsI had this problem for a while also, and my solution was to change in the urlpatterns, in urls.py
change url(r'^$', views.hello_world) to url(r'^$', views.hello_world, name='home' ),
2 Answers
afif afiam
82 PointsI think you're using Django 1.10.x the syntax for a URL Tag is different :
First, update the urlpattern in your main urls.py : url(r'^$', views.hello_world, name='home')
Then replace the 'views.hello_world' part of the URL Tag : <a href="{% url 'home' %}">Home</a>
Bogdan Lalu
6,419 Pointsthanks for the tip this helped me as well as I am using 1.10 :)
Liviu Cucerenco
8,039 PointsI had the same problem and the solution worked for me as well. Thank you very much.
Glenn Velupillai
7,697 PointsYes Afif Afiam! This does the trick! Thank you. Upvoted!
Sion Silyn Roberts
498 PointsMe too. A big thank you, Afif. The "big button" doesn't happen so I assume the .css file needs updating too.
Alexander Joseph
220 PointsI had this problem, tried the fix and still didnt work (at least I thought it didnt)
my problem was I had commented out the obsolete django template anchor with a note saying it didnt work in 1.10. Coming from php i thought this would be fine. The error was coming from django picking up the old link from inside the comment
Greg Wienecke
20,765 PointsThank you, Alexander! This was driving me crazy, I had mine commented out too and didn't know what was going wrong. Can someone explain this to me? How is Django still picking up the link inside a comment?
Cheo R
37,150 PointsCheo R
37,150 PointsHello Christian, can you post a snapshot of your workspace. I had this error before and it was because I had misspelled the hello_world view in the views.py file.