diff --git a/core/urls.py b/core/urls.py index 77e92462e31f89237712c9430876d8c5f5deaa60..5d19d70094339c626264b6db88d140c7fed8606a 100644 --- a/core/urls.py +++ b/core/urls.py @@ -13,14 +13,15 @@ Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ -from django.conf.urls.static import static -from django.contrib import admin -from django.urls import path, include - from core import settings +from django.contrib import admin +from django.urls import path, include, re_path +from django.views.static import serve urlpatterns = [ path("admin/", admin.site.urls), path("accounts/", include("django.contrib.auth.urls")), path("", include("{{app_to_install}}.urls")), -] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + re_path(r"^media/(?P<path>.*)$", serve, {"document_root": settings.MEDIA_ROOT}), + re_path(r"^static/(?P<path>.*)$", serve, {"document_root": settings.STATIC_ROOT}), +]