I am getting Page not found (404)
error after I set up the media folder as follows in settings.py:
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'
then in urls.py:
from django.contrib import admin
from django.urls import path
from django.conf.urls.static import static
from django.conf import settings
urlpatterns = [
path('admin/', admin.site.urls),
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT).
After this when I try to run the server, I am getting the following message: Using the URLconf defined in personal_portfolio.URLs, Django tried these URL patterns, in this order:
admin/
^media/(?P<path>.*)$
The empty path didn’t match any of these.
Where is the mistake?