From 9f240e96f077109ab8e5d63c8250ab544c31f0f8 Mon Sep 17 00:00:00 2001 From: "nabijonovdavronbek619@gmail.com" Date: Sat, 6 Dec 2025 19:49:02 +0500 Subject: [PATCH] media and static file added --- content/urls.py | 6 ++++++ portfolio_admin/settings.py | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/content/urls.py b/content/urls.py index c24c812..3353ba4 100644 --- a/content/urls.py +++ b/content/urls.py @@ -1,3 +1,5 @@ +from django.conf import settings +from django.conf.urls.static import static from django.urls import path from .views import get_products, create_contact @@ -5,3 +7,7 @@ urlpatterns = [ path('products/', get_products), # GET path('contact/', create_contact), # POST ] + + +urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) +urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) \ No newline at end of file diff --git a/portfolio_admin/settings.py b/portfolio_admin/settings.py index 01ba429..1351ae0 100644 --- a/portfolio_admin/settings.py +++ b/portfolio_admin/settings.py @@ -137,6 +137,11 @@ USE_TZ = True # https://docs.djangoproject.com/en/5.2/howto/static-files/ STATIC_URL = 'static/' +STATIC_URL = BASE_DIR / 'resources/static' + + +MEDIA_URL = 'media/' +MEDIA_URL = BASE_DIR / 'resources/media' # Default primary key field type # https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field