# URL not found

**URL:** <https://forum.djangoproject.com/t/url-not-found/4588>\
**Category:** Using Django\
**Created:** [October 1, 2020, 1:40am UTC](https://forum.djangoproject.com/t/url-not-found/4588 "2020-10-01T01:40:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arthoxi](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@Arthoxi](https://forum.djangoproject.com/u/Arthoxi)\
**Post date:** [October 1, 2020, 1:40am UTC](https://forum.djangoproject.com/t/url-not-found/4588/1 "2020-10-01T01:40:43Z")

</div>

Hi, I am having an error 404 when clicking a link when the url is in an app url instead of django url, but the link is working if the url is in the django url. I have been googling for days and read the documentation, nothing is working.

Here are the codes in the django urls:-

```auto
from django.contrib import admin

from django.urls import path, include

from pages.views import homepage_view, about_view, experts_view

urlpatterns = [

    path('', homepage_view, name='home'),

    path('home/', homepage_view, name='home'),

    path('about_us/', about_view, name='about_us'),

    path('experts/', experts_view, name='experts'),

    path('blog/', include('blog.urls')) ,

    path('admin/', admin.site.urls),

]

```

Here are the codes in the app urls:-

```auto

from blog import views

from django.urls import path

name_app = 'blog'

urlpatterns = [

    path('', views.PostList.as_view(), name='blog'),

    path('<slug:slug>/', views.PostDetail.as_view(), name='post_detail'),

    path('create/', views.PostCreateView.as_view(), name='create'),

]

```

The code when I click the link:-

```auto

{% block sidebar %}

<style>

        .card{

            box-shadow: 0 16px 48px #E3E7EB;

        }

       

</style>

<!-- Sidebar Column -->

<div class="col-md-4 float-right ">

<div class="card my-4">

        <h5 class="card-header">About Us</h5>

    <div class="card-body">

        <p class="card-text"> Test</p>

        <a href="{% url 'create' %}"

           class="btn btn-danger">Know more!</a>

    </div>

</div>

</div>

{% endblock sidebar %}

```

I think the problem is in “{% url ‘create’ %}”

Note that all other links in the app urls is working except for “create”.

Thank you in advance.

---

<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 1, 2020, 2:26am UTC](https://forum.djangoproject.com/t/url-not-found/4588/2 "2020-10-01T02:26:58Z")

</div>

That’s the template being rendered - can you show how that link shows up in the browser after being rendered?

---

<div class="post-metadata">

**Author:** ![Arthoxi](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@Arthoxi](https://forum.djangoproject.com/u/Arthoxi)\
**Post date:** [October 1, 2020, 7:44am UTC](https://forum.djangoproject.com/t/url-not-found/4588/3 "2020-10-01T07:44:33Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/4/427ec436b98fd53327a20359a64f76ab8ee8ad63.png)

This is the link that shows up after I click “{% url ‘create’ %}”

---

<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 1, 2020, 12:18pm UTC](https://forum.djangoproject.com/t/url-not-found/4588/4 "2020-10-01T12:18:13Z")

</div>

Ahh… I see the issue here.

The urlpatterns are checked in the order that they’re defined. You’re issuing a request for the url `/blog/create/`. However, as urlpatterns is being checked, ‘create/’ is going to pass the test for `<slug:slug>/` and dispatch to PostDetail. It’s never going to even check against `'create/'`.

You’ve got at least two options here:

1. Change your path for PostDetail to (perhaps) be something like `'view/<slug:slug>/'` (My recommendation)
2. Move the `'create/'` path ahead of the `'<slug:slug>/'` path.

Ken

---

<div class="post-metadata">

**Author:** ![Arthoxi](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@Arthoxi](https://forum.djangoproject.com/u/Arthoxi)\
**Post date:** [October 2, 2020, 12:34am UTC](https://forum.djangoproject.com/t/url-not-found/4588/5 "2020-10-02T00:34:41Z")

</div>

OMG! Thank you so much! You’re a lifesaver! Everything is working now.

---

<div class="post-metadata">

**Author:** ![saramin-bit](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/saramin-bit/32/4814_2.png) [@saramin-bit](https://forum.djangoproject.com/u/saramin-bit)\
**Post date:** [June 10, 2021, 7:13pm UTC](https://forum.djangoproject.com/t/url-not-found/4588/6 "2021-06-10T19:13:10Z")

</div>

![erreurDjango](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/c/ce1e09cce27d702209e630a4e391c63fa324f68b.png)  
Hello there i hope you’re doing fine, i faced the same problem and i thought maybe you could help me, i’m new with django.
