0

I am getting the following error

NoReverseMatch at /blog/index/

and

Reverse for 'feed_articles' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

just because I deleted/commented out a url I know longer need. The url isn't blog/index either. something tells me it's an ordering issue because I've had that happen before in my django app. But I am confused. Heres what I commented out

from django.conf.urls import url, include
  from . import views

  urlpatterns = [
     url(r'^$', views.post_list, name='post_list'),

     url(r'^index/$', views.index, name='index'),
     url(r'^video_submission/$', views.video_submission, name='submission'),
     url(r'^contact/$', views.contact, name='contact'),
     url(r'^privacy/$', views.privacy, name='privacy'),
     url(r'^dmca/$', views.dmca, name='dmca'),
     url(r'^terms/$', views.terms, name='terms'),
     url(r'^search/$', views.post_search, name='post_search'),
     url(r'^create/$', views.post_create, name='create'),
     url(r'^images/$', views.static_images, name='static_images'),
     url(r'^video_agreement/$', views.video_agreement, name='video_agreement'),

     ### url(r'^feed_articles/$', views.articles_list, name='feed_articles'),
     url(r'^feeds/$', views.feed_list, name='feed_list'),
     url(r'^feeds/new$', views.new_feed, name='new_feed'),
     url(r'^(?P<id>\d+)/feed_delete/$', views.feed_delete, name='feed_delete'),
     url(r'^(?P<id>\d+)/article_delete/$', views.article_delete, name='article_delete'),
     url(r'^tag/(?P<tag_slug>[-\w]+)/$', views.post_list,
         name='post_list_by_tag'),
     url(r'^(?P<slug>[\w-]+)/$', views.post_detail, name='post_detail'),
     url(r'^(?P<slug>[\w-]+)/edit/$', views.post_update, name='update'),
     url(r'^(?P<id>\d+)/delete/$', views.post_delete, name='delete'),

How can I correct my syntax so that this minor issue will work?

EDIT my view being called by blog/index

{% extends 'blog/base.html' %}
  {% load staticfiles %}


  <style>
  {% block style %}
    #hite{
      min-height: 720px;
    }

   .post{
        min-height: 157px;
        max-height: 157px;
        width: 100%;
    }

   .tall{
     height: 300px;
   }
  {% endblock style %}
  </style>


  {% block content %}

    <div id="hite">



      <h1>worldstar</h1>
      {% for d in divs %}
          <div class="col-sm-6 col-md-4" style="margin-top: 30px">
          <div class="thumbnail thumb tall">
            <img src="{{d.src}}" alt="{{ d.text }}" class="img-responsive post">
            <div class="caption">
              <h5>{{ d.text }}</h5>
              <p></p>
              <p><a href="{{d.url}}{{ d.href }}" class="btn btn-primary" role="button">World *</a></p>
            </div>
          </div>
          </div>
      {% endfor %}



        {% for a in articles %}
              <div class="col-sm-6 col-md-4" style="margin-top: 30px" >
                  <div class="thumbnail thumb tall">
                      <div class="caption">
                      <h4 style="height: 100px">{{a.title}}</h4>
                      <p>{{a.description|truncatechars:30 | safe}}</p>
                      <h4>From: {{a.feed|truncatechars:30}}</h4>
                      <p>
                          <a href="{{a.url}}" target="_blank" class="btn btn-primary">View Article</a>

                      {% if user.is_authenticated %}
                      <a href="{% url 'blog:article_delete' a.id %}" class="btn btn-primary">delete</a>
                      {% endif %}
                      </p>
                      </div>
                  </div>
              </div>
          {% endfor %}



    </div>
  {% endblock %}

my feed_articles

 {% extends 'blog/base.html' %}


  <style>
      {% block style %}

          /*ul{*/
              /*list-style: none;*/
          /*}*/

      #hi{
          min-height: 720px;
          margin-top: 15px;
      }

      {% endblock style %}
  </style>

  {% block jumbotron %}
      <h1>HArticles</h1>
      <p> Have a look around at some of the latest  news Here and abroad</p>
  {% endblock jumbotron %}


  {% block content %}
      <div class="row" id="hi">
          {% for a in articles %}
              <div class="col-xs-12 col-sm-4 col-md-3 col-lg-6" >
                  <div class="thumbnail" style="height: 250px; padding-left: 10px">
                      <h4 style="height: 100px">{{a.title}}</h4>
                      <p>{{a.description|truncatechars:30 | safe}}</p>
                      <h4>From: {{a.feed|truncatechars:30}}</h4>
                      <p>
                          <a href="{{a.url}}" target="_blank" class="btn btn-primary">View Article</a>

                      {% if user.is_authenticated %}
                      <a href="{% url 'blog:article_delete' a.id %}" class="btn btn-primary">delete</a>
                      {% endif %}
                      </p>
                  </div>
              </div>
          {% endfor %}
      </div>
  {% endblock content %}


  {% block aside %}
      <h3 class="panel-body panel panel-default text-center"></h3>
  {% endblock aside %}
nothingness
  • 971
  • 3
  • 10
  • 18
  • 1
    It's not telling you that the url is 'blog/index', it's telling you that somewhere in the template rendered by the view at 'blog/index' there is a url pointing to `feed_articles` – Curtis Olson May 13 '16 at 19:53
  • @CurtisOlson thats what I thought originally so I hit command+f to search my code and nothings there matching that – nothingness May 13 '16 at 19:55
  • 1
    Find the template that is being rendered by whichever view is being called when `/blog/index/` is requested, and look in that template for `{% url 'path_to_this_urls_file:feed_articles' %}` – Curtis Olson May 13 '16 at 19:59
  • @CurtisOlson I added it up top so you could see for your self. – nothingness May 13 '16 at 20:18
  • 2
    Cool thanks. Did you also check your templates which this template extends? In this case, `blog/base.html` along with any templates which that one extends and/or includes, including template tags – Curtis Olson May 13 '16 at 20:28
  • Yes. I don't understand why me deleting that url should affect anything – nothingness May 13 '16 at 20:55
  • How is this question getting a negative review? Everything I've put is within the confines of what's to be reasonably asked. I've seen other questions on here and they have not gotten negative marks like right [here](http://stackoverflow.com/questions/21240680/django-noreversematch) – nothingness May 13 '16 at 21:11
  • Not sure why the negatives. Anyways, without seeing more template code I can't be of more help. Somewhere in a template there is a (reverse) reference to that url - maybe ask a colleague to look; A fresh set of eyes can do wonders. – Curtis Olson May 13 '16 at 21:30
  • 1
    @CurtisOlson messing arounsd with it I've noticed It works when I am not signed in. All the links work but soon as I sign in and go to the index page it doesn't work. I did a file search all and the name for the url is not present. Then I sign out and it works again – nothingness May 13 '16 at 22:21
  • @CurtisOlson I found it. You should make a real answer so I can give you credit because you were right. It couldnt be found whenI was searching it because it was commented out. weird. The fact it worked when I signed out made me rethink what you said and search line by line until I came across it. – nothingness May 13 '16 at 22:30

1 Answers1

0

Find the template that is being rendered by whichever view is being called when '/blog/index/' is requested, and look in that template for {% url 'path_to_this_urls_file:feed_articles' %}. Also look in any templates which that template extends and/or includes, including template tags.

Curtis Olson
  • 947
  • 1
  • 5
  • 10