Files
2026-etpgrf-site/etpgrf_site/etpgrf_site/urls.py

24 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from blog import views as blog_views # Импортируем views из приложения blog
from blog.models import PostType # Для использования в корневом urls.py
urlpatterns = [
path('adm-in/', admin.site.urls),
path('', include('typograph.urls')), # Основное приложение типографа
# Блог
path('blog/', include('blog.urls')),
# Статические страницы (ловушка в самом конце, чтобы не перехватывать другие URL)
# Исключаем слаги, которые могут конфликтовать с другими URL-ами
# Например, 'admin', 'blog', 'static', 'media'
path('<slug:slug>/', blog_views.page_detail, name='page_detail'),
]
# Для отдачи медиафайлов в режиме разработки
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)