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}), +] diff --git a/start.sh b/start.sh index 25edc82011ed3de96f757d06ec5a645d0ee3cce4..0a4975b7f2554b71ddf877ee4ff748cd86504ff4 100644 --- a/start.sh +++ b/start.sh @@ -1,5 +1,4 @@ #!/bin/bash -source /venv/bin/activate cd /app || exit echo "----- Collect static files ------ "