# Django AssertionError: 404 != 200

**URL:** <https://forum.djangoproject.com/t/django-assertionerror-404-200/16325>\
**Category:** Forms & APIs\
**Created:** [October 4, 2022, 11:45am UTC](https://forum.djangoproject.com/t/django-assertionerror-404-200/16325 "2022-10-04T11:45:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![HappyCoder77](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/happycoder77/32/10241_2.png) [@HappyCoder77](https://forum.djangoproject.com/u/HappyCoder77)\
**Post date:** [October 4, 2022, 11:45am UTC](https://forum.djangoproject.com/t/django-assertionerror-404-200/16325/1 "2022-10-04T11:45:40Z")

</div>

Hi everybody,

I have a Class based view:

```auto
class PromocionListView(ListView):
    model = Promocion

```

and this url path:

```auto
urlpatterns = [
    path('promocion/list', PromocionListView.as_view(), name='promocion_list')]

```

so I made the following test:

```auto
class PromocionTests(TestCase):

    @classmethod
    def setUpTestData(cls):
        cls.promocion = Promocion.objects.create(fecha_de_inicio = date(2022,7,6),duracion = 90)

    def test_url_exists_at_correct_location(self):
        response = self.client.get('promocion/list')
        self.assertEqual(response.status_code, 200)

```

but it is showing the error: AssertionError: 404 != 200. Does anything knows why this is happening? I googled it a lot but I couldn’t find an answer

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [October 4, 2022, 12:31pm UTC](https://forum.djangoproject.com/t/django-assertionerror-404-200/16325/2 "2022-10-04T12:31:14Z")

</div>

Is that url in your root urls.py file? If not, what urls.py file is it in and what url leads you to that entry?

Have you tried accessing that url as an absolute url? (`/promocion/list`)

---

<div class="post-metadata">

**Author:** ![CodenameTim](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/codenametim/32/31507_2.png) [@CodenameTim](https://forum.djangoproject.com/u/CodenameTim)\
**Post date:** [October 5, 2022, 2:35pm UTC](https://forum.djangoproject.com/t/django-assertionerror-404-200/16325/3 "2022-10-05T14:35:34Z")

</div>

Additionally if you install [django-extensions](https://django-extensions.readthedocs.io/en/latest/) there’s a really neat command called [`show_urls`](https://django-extensions.readthedocs.io/en/latest/command_extensions.html). I use that frequently when I’m having Django URL routing issues.

---

<div class="post-metadata">

**Author:** ![HappyCoder77](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/happycoder77/32/10241_2.png) [@HappyCoder77](https://forum.djangoproject.com/u/HappyCoder77)\
**Post date:** [October 10, 2022, 2:32pm UTC](https://forum.djangoproject.com/t/django-assertionerror-404-200/16325/4 "2022-10-10T14:32:17Z")

</div>

Hello, thanks for answer. No, the url lives in he urls.py file of the app.  
`urlpatterns = [... path('dashboard/', include('dashboard.urls'))]`  
as you can see the app’s name is dashboard, so it is included in the root urls.py file. The dahsboard app has its own urls.py file whit the path that I write in the question in it. Sorry for my bad english. I hope you can understand me 😊  
I also tried to to access the url in the way you´re pointing. But it doesn´t still work

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [October 10, 2022, 2:34pm UTC](https://forum.djangoproject.com/t/django-assertionerror-404-200/16325/5 "2022-10-10T14:34:04Z")

</div>

If the full path of that url is /dashboard/promocion/list, then _that_ is the url you need to use.

---

<div class="post-metadata">

**Author:** ![HappyCoder77](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/happycoder77/32/10241_2.png) [@HappyCoder77](https://forum.djangoproject.com/u/HappyCoder77)\
**Post date:** [October 10, 2022, 2:35pm UTC](https://forum.djangoproject.com/t/django-assertionerror-404-200/16325/6 "2022-10-10T14:35:45Z")

</div>

OK, I’ll try it and and wirte you again. Thanks!

---

<div class="post-metadata">

**Author:** ![HappyCoder77](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/happycoder77/32/10241_2.png) [@HappyCoder77](https://forum.djangoproject.com/u/HappyCoder77)\
**Post date:** [October 10, 2022, 2:42pm UTC](https://forum.djangoproject.com/t/django-assertionerror-404-200/16325/7 "2022-10-10T14:42:39Z")

</div>

Oh that was all! If worked perfectly! Than you very much for your invaluable help.
