Это в основном ошибка, которую я получаю
магазины / URLs
#/shop/
from django.urls import path`enter code here
from . import views
app_name='shop'
urlpatterns = [
path('', views.allProdCat, name='allProdCat'),
path('<slug:c_slug>/', views.allProdCat, name='products_by_category'),
path('<slug:c_slug>/<slug:product_slug>/', views.ProdCatDetail, name='ProdCatDetail'),
]
магазин / шаблоны / магазин / заголовок
{% load staticfiles %}
<header>
<center>
<a href="{% url 'shop:allProdCat' %}"><img class ='zapp-logo' src="{% static 'img/zapp_banner.jpg' %}" alt="Logo "></a>
</center>
</header>
Прошел некоторые поиски, не нашел никаких решений. Кто-нибудь знает проблему?
from django.contrib import admin
from django.urls import path, include
from shop import views
from django.conf import settings
from django.conf.urls.static import static
РЕДАКТИРОВАТЬ:
main / shop / templates / shop / base.html (заголовок начинается с)
{% load staticfiles %}
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="{% block metadescription %}{% endblock %}">
<link rel="stylesheet" href="{% static 'css/custom.css' %}">
<link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
<link rel="stylesheet" href="{% static 'css/all.css' %}">
<title>{% block title %}{% endblock %}</title>
</head>
<body>
<div class='container'>
{% include 'shop/header.html' %}
{% include 'shop/navbar.html' %}
{% block content %}
{% endblock %}
</div>
{% include 'shop/footer.html' %}
<script src="{% static 'js/jquery-3.3.1.slim.min.js' %}"></script>
<script src="{% static 'js/popper.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
</body>
</html>
главная / URLs
urlpatterns = [
path('admin/', admin.site.urls),
path('shop/', include('shop.urls')),
path('cart/', include('cart.urls')),
]
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
main / settings (некоторые части)
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'shop',
'cart',
]
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'shop', 'templates/'), os.path.join(BASE_DIR, 'cart', 'templates/')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'shop.context_processor.menu_links'
],
},
},
]