Skip to content

Commit

Permalink
Bug fix for serving static content
Browse files Browse the repository at this point in the history
  • Loading branch information
conorheffron committed Sep 7, 2024
1 parent 9b57a14 commit fa8582c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions littlelemon/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.urls import path, include, re_path
from django.urls import path, include
from django.conf import settings
from django.conf.urls import handler404
from django.views.static import serve
from restaurant import views

handler404 = views.handler404

urlpatterns = [
path('', include('restaurant.urls')),
path('static/<path:path>/', serve, {'document_root': settings.STATIC_ROOT, }),
re_path(r'.*', views.handler404)
]
1 change: 0 additions & 1 deletion restaurant/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from django.urls import path
from restaurant import views


urlpatterns = [
path('', views.form_view, name="home"),
path('book/', views.form_view, name="book"),
Expand Down
2 changes: 1 addition & 1 deletion restaurant/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

logger = logging.getLogger(__name__)

def handler404(request):
def handler404(request, exception):
"""Resolve bad request path
Parameters
----------
Expand Down

0 comments on commit fa8582c

Please sign in to comment.