This is my mysite/url,py
On Sunday, October 4, 2015 at 9:43:46 PM UTC+2, James Schneider wrote:
-- from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^polls/', include('polls.urls',namespace = "polls")),
].
On Sunday, October 4, 2015 at 9:43:46 PM UTC+2, James Schneider wrote:
My guess it's that your polls/urls.py file is not being processed/included properly since none of your URL patterns were even tried.
What does your mysite/urls.py file look like?
-James
On Oct 4, 2015 12:35 PM, "jahan" <jva...@gmail.com> wrote:Hi James,--
This is the errorNoReverseMatch at /polls/1/
Reverse for 'detail' with arguments '(1,)' and keyword arguments '{}' not found. 0 pattern(s) tried: []
Request Method: GET Request URL: http://localhost:8000/polls/1/ Django Version: 1.8.4 Exception Type: NoReverseMatch Exception Value: Reverse for 'detail' with arguments '(1,)' and keyword arguments '{}' not found. 0 pattern(s) tried: []Exception Location: /usr/local/lib/python2.7/dist- packages/django/core/ urlresolvers.py in _reverse_with_prefix, line 496 Python Executable: /usr/bin/python Python Version: 2.7.3 Python Path: ['/var/www/django/mysite', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib- dynload', '/usr/local/lib/python2.7/ dist-packages', '/usr/lib/python2.7/dist- packages', '/usr/lib/python2.7/dist- packages/PIL', '/usr/lib/python2.7/dist- packages/gst-0.10', '/usr/lib/python2.7/dist- packages/gtk-2.0', '/usr/lib/python2.7/dist- packages/ubuntu-sso-client', '/usr/lib/python2.7/dist- packages/ubuntuone-client', '/usr/lib/python2.7/dist- packages/ubuntuone-control- panel', '/usr/lib/python2.7/dist- packages/ubuntuone-couch', '/usr/lib/python2.7/dist- packages/ubuntuone-installer', '/usr/lib/python2.7/dist- packages/ubuntuone-storage- protocol'] Server time: Sun, 4 Oct 2015 19:31:13 +0000 Error during template rendering
In template
/var/www/django/mysite/polls/
, error at line 4templates/polls/detail.html Reverse for 'detail' with arguments '(1,)' and keyword arguments '{}' not found. 0 pattern(s) tried: []
1 <h1>{{ question.question_text }}</h1> 2 <ul> 3 {% for choice in question.choice_set.all %} 4 <li><a href=" {% url 'detail' question.id %} ">{{ choice.choice_text }}</a></li> 5 {% endfor %} 6 </ul> 7
On Sunday, October 4, 2015 at 9:04:48 PM UTC+2, James Schneider wrote:Can you paste the entire error?
Also, read through the error page, it should show you which line is causing the problem.
-James
On Oct 4, 2015 9:24 AM, "jahan" <jva...@gmail.com> wrote:Hi Django group,--
I'm following the tutorial and get stuck on part 3, Removing hardcoded URLs in templates
I read through the topics that discuss this, but can't find the issue in my case.
my detail.html template looks like
<h1>{{ question.question_text }}</h1>
<ul>
{% for choice in question.choice_set.all %}
<li><a href="{% url 'detail' question.id %}">{{ choice.choice_text }}</a></li>
{% endfor %}
</ul>
in my urls.py for the polls project I have
urlpatterns = [
url(r'^$', 'index', name="index"),
url(r'^(?P<question_id>\d+)/$' , views.detail, name="detail"),
url(r'^(?P<question_id>\d+)/results/$' , 'results', name="results"),
url(r'^(?P<poll_id>\d+)/vote/$' , 'vote', name="vote"),
]
Thanks for any suggestion,
jack
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 http://groups.google.com/group/django-users .
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/298b2f49- .8374-4e54-bfd3-639a7de3af7f% 40googlegroups.com
For more options, visit https://groups.google.com/d/optout .
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 http://groups.google.com/group/django-users .
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/370a3815- .c5c7-4eb7-bd50-cfd689a44c96% 40googlegroups.com
For more options, visit https://groups.google.com/d/optout .
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7e69bce4-6626-4d9c-bfde-076352d1ff4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment