Pages are rendered server-side (SEO, no build step), the interactive parts talk to the existing REST API from the browser: - home: banners, categories, hits and new arrivals - catalog: filters (category, brand, price, stock), search, sorting, pagination, filter chips with one-click removal - product card: gallery, price with discount, stock, characteristics, related products - cart: localStorage, quantity controls, live totals - checkout: contacts, delivery, promo code, bonuses, order submission with Idempotency-Key, success screen - login: OTP by phone (debug code shown in dev) and phone/password - account: profile, orders, addresses, bonuses through the API with JWT - static pages from the admin Supporting pieces: - apps/storefront app with views, urls, templates and static CSS/JS - money/discount/attribute template filters - seed_demo management command with demo catalog, banners and pages - Cyrillic search fallback for SQLite: local DB does not fold case for non-ASCII, production PostgreSQL does Tests: 16 storefront cases (pages, filters, search, ordering, 404s, filters formatting); the suite is 61 passing.
49 lines
1.8 KiB
Python
49 lines
1.8 KiB
Python
"""URL configuration for the HOMM backend."""
|
|
from django.conf import settings
|
|
from django.conf.urls.static import static
|
|
from django.contrib import admin
|
|
from django.urls import include, path
|
|
from drf_spectacular.views import (
|
|
SpectacularAPIView,
|
|
SpectacularRedocView,
|
|
SpectacularSwaggerView,
|
|
)
|
|
|
|
from apps.common.api_docs import api_docs_view
|
|
|
|
admin.site.site_header = "HOMM — управление магазином"
|
|
admin.site.site_title = "HOMM Admin"
|
|
admin.site.index_title = "Панель управления"
|
|
admin.site.index_template = "admin/homm_index.html"
|
|
|
|
urlpatterns = [
|
|
path("admin/", admin.site.urls),
|
|
path("api/v1/", include("apps.common.urls")),
|
|
path("api/v1/auth/", include("apps.accounts.urls")),
|
|
path("api/v1/catalog/", include("apps.catalog.urls")),
|
|
path("api/v1/orders/", include("apps.orders.urls")),
|
|
path("api/v1/loyalty/", include("apps.loyalty.urls")),
|
|
path("api/v1/content/", include("apps.content.urls")),
|
|
path("api/v1/payments/", include("apps.payments.urls")),
|
|
path("api/v1/integration/1c/", include("apps.integration.urls")),
|
|
path("api/schema/", SpectacularAPIView.as_view(), name="schema"),
|
|
# Self-contained reference: works without internet access (no CDN).
|
|
path("api/docs/", api_docs_view, name="api-docs"),
|
|
# Full Swagger UI / ReDoc: need access to the jsdelivr CDN.
|
|
path(
|
|
"api/swagger/",
|
|
SpectacularSwaggerView.as_view(url_name="schema"),
|
|
name="swagger-ui",
|
|
),
|
|
path(
|
|
"api/redoc/",
|
|
SpectacularRedocView.as_view(url_name="schema"),
|
|
name="redoc",
|
|
),
|
|
# Customer-facing storefront. Keep it last: it owns the site root.
|
|
path("", include("apps.storefront.urls")),
|
|
]
|
|
|
|
if settings.DEBUG:
|
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|