title: Why my testing function in the Django returns status code 404 while the page is shown correctly in the chrome browser?
body: <p>I am a Django novice and I am trying to proceed with a simple application testing and I follow a tutorial (simpleisbetterthancomplex). One of the tests fails but I cannot find the reason why. I added several prints to clear what was going on. </p>
  
  <p>The test function that fails is:</p>
  
  <pre><code>from django.core.urlresolvers import reverse
  from django.urls import resolve
  from django.test import TestCase
  from .views import home, board_topics
  from .models import Board
  
  # some code here
  
  class BoardTopicsTests(TestCase):
  #....
      def test_board_topics_view_contains_navigation_links(self):
          board_topics_url = reverse('board_topics', kwargs={'pk': 1})
          print("49: board_topic = " + board_topics_url)
          homepage_url = reverse('home')
          print("51: homepage_url = " + homepage_url)
          new_topic_url = reverse('new_topic', kwargs={'pk': 1})
          print("53: new_topic_url = " + new_topic_url)
          response = self.client.get(board_topics_url)
          print("*****************\n")
          print(response)
          print('********************\n')
          self.assertContains(response, 'href="{0}"'.format(homepage_url))
          self.assertContains(response, 'href="{0}"'.format(new_topic_url))
  #...
  </code></pre>
  
  <p>Then I can see the output:</p>
  
  <pre><code>Creating test database for alias 'default'...
  System check identified no issues (0 silenced).
  .49: board_topic = /boards/1/
  51: homepage_url = /
  53: new_topic_url = /boards/1/new/
  *****************
  
  &lt;HttpResponseNotFound status_code=404, "text/html"&gt;
  ********************
  </code></pre>
  
  <p>It looks like board_topics_url is not working. But in my chrome explorer it works very good and returns a page with both links homepage_url = '/' and new_topic_url = '/boards/1/new/':</p>
  
  <pre><code> ...      
    &lt;li class="breadcrumb-item"&gt;&lt;a href="/"&gt;Boards&lt;/a&gt;&lt;/li&gt;
    &lt;li class="breadcrumb-item active"&gt;Django&lt;/li&gt;
        &lt;/ol&gt;
  
      &lt;div class="mb-4"&gt;
          &lt;a href="/boards/1/new/" class="btn btn-primary"&gt;New topic&lt;/a&gt;
      &lt;/div&gt;
  ...
  
  </code></pre>
  
  <p>Both links are working correctly. </p>
  
  <p>Please, any idea what could be wrong? Thank you very much for any help. </p>