404 Handler

Happy_JG·2024년 7월 10일
0

Django

목록 보기
32/32

프로젝트 파일 urls.py

	handler404 = 'project.views.error_404_view'

앱 views.py

  def error_404_view(request, exception):
      return render(request, '404.html', status=404)

앱 templates/404.html

  <!DOCTYPE html>
  <html lang="en">
  <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Page Not Found</title>
  </head>
  <body>
      <h1>404 - Page Not Found</h1>
      <p>Sorry, the page you are looking for does not exist.</p>
  </body>
  </html>
profile
hello!

0개의 댓글