from django.urls import path
from .views import *
from django.conf.urls.static import static
from django.conf import settings
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns = [
path('', post_list, name='posts_list_url'),
path('post/create/', PostCreate.as_view(), name='post_create_url'),
path('post/<str:slug>/', PostDetail.as_view(), name='post_detail_url'),
path('post/<str:slug>/update/', PostUpdate.as_view(), name='post_update_url'),
path('post/<str:slug>/delete/', PostDelete.as_view(), name='post_delete_url'),
path('tags/', tag_list, name='tags_list_url'),
path('tag/create', TagCreate.as_view(), name='tag_create_url'),
path('tag/<str:slug>/', TagDetail.as_view(), name='tag_detail_url'),
path('tag/<str:slug>/update/', TagUpdate.as_view(), name='tag_update_url'),
path('tag/<str:slug>/delete', TagDelete.as_view(), name='tag_delete_url'),
]
urlpatterns += staticfiles_urlpatterns()
urlpatterns +=static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.contrib import admin
from django.urls import path, include
from .views import redirect_blog
urlpatterns = [
path('', redirect_blog),
path('admin/', admin.site.urls),
path('blog/', include('blog.urls')),
]
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/media/img.jpg
GET http://127.0.0.1:8000/media/img.jpg 404 (Not Found)