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:-
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:-
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:-
{% 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.