Skip to content

Commit

Permalink
add doesn't exist page&url
Browse files Browse the repository at this point in the history
  • Loading branch information
faresemad committed Apr 25, 2023
1 parent f4d67dc commit 23a0e34
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
5 changes: 4 additions & 1 deletion project/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
from django.urls import path, include
from django.urls import path, include, re_path
from drf_spectacular.views import SpectacularAPIView, SpectacularRedocView, SpectacularSwaggerView
from django.views.generic import TemplateView

urlpatterns = [
path('admin/', admin.site.urls),
Expand All @@ -17,6 +18,8 @@
# API schema
path('api/schema/swagger-ui/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
path('api/schema/redoc/', SpectacularRedocView.as_view(url_name='schema'), name='redoc'),
# Invalid path
re_path(r'^.*', TemplateView.as_view(template_name='index.html')),
]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Expand Down
24 changes: 24 additions & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Artech System</title>
</head>
<body>
<h1>This Directory Isn't Exist</h1>
<style>
body{
background-color: rgba(193, 187, 187, 0.633);
}
h1{
text-align: center;
color: rgb(22, 54, 2);
font-family: 'Courier New', Courier, monospace;
font-weight: bold;
font-size: 50px;
}
</style>
</body>
</html>

0 comments on commit 23a0e34

Please sign in to comment.