error handeling
This commit is contained in:
Binary file not shown.
8
begin.py
8
begin.py
@ -24,3 +24,11 @@ def user(name):
|
|||||||
return render_template('user.html', name=name,
|
return render_template('user.html', name=name,
|
||||||
stuff=stuff,
|
stuff=stuff,
|
||||||
liste=liste)
|
liste=liste)
|
||||||
|
|
||||||
|
@app.errorhandler(404)
|
||||||
|
def page_not_found(e):
|
||||||
|
return render_template('404.html')
|
||||||
|
|
||||||
|
@app.errorhandler(500)
|
||||||
|
def page_not_found(e):
|
||||||
|
return render_template('500.html')
|
92
templates/404.html
Normal file
92
templates/404.html
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>404 - Page Not Found</title>
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body, html {
|
||||||
|
height: 100%;
|
||||||
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
|
background-color: #f1f1f1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #f1f1f1;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 10rem;
|
||||||
|
color: #FF6347;
|
||||||
|
letter-spacing: 1rem;
|
||||||
|
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
animation: bounce 1s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 2rem;
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 20px 0;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
color: #777;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-link {
|
||||||
|
padding: 12px 30px;
|
||||||
|
background-color: #FF6347;
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
border-radius: 50px;
|
||||||
|
transition: background-color 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-link:hover {
|
||||||
|
background-color: #ff4500;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes bounce {
|
||||||
|
0%, 100% {
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
transform: translateY(-10px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-image {
|
||||||
|
width: 300px;
|
||||||
|
height: auto;
|
||||||
|
margin: 20px auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div>
|
||||||
|
<h1>404</h1>
|
||||||
|
<h2>Oops! Page Not Found</h2>
|
||||||
|
<img src="https://via.placeholder.com/300x300?text=Oops" alt="Error Image" class="error-image">
|
||||||
|
<p>It looks like the page you are trying to reach doesn't exist.</p>
|
||||||
|
<p>But don't worry, you can go back to the homepage by clicking the button below.</p>
|
||||||
|
<a href="/" class="home-link">Go Home</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
93
templates/500.html
Normal file
93
templates/500.html
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>500 - Internal Server Error</title>
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body, html {
|
||||||
|
height: 100%;
|
||||||
|
font-family: 'Arial', sans-serif;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 8rem;
|
||||||
|
color: #ff6b6b;
|
||||||
|
letter-spacing: 0.5rem;
|
||||||
|
text-shadow: 3px 3px 5px rgba(0, 0, 0, 0.1);
|
||||||
|
animation: pulse 1s infinite alternate;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 2.5rem;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
color: #666;
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reload-link {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 12px 25px;
|
||||||
|
background-color: #ff6b6b;
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
border-radius: 50px;
|
||||||
|
transition: background-color 0.3s;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reload-link:hover {
|
||||||
|
background-color: #ff4747;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-image {
|
||||||
|
width: 300px;
|
||||||
|
height: auto;
|
||||||
|
margin: 30px auto;
|
||||||
|
border-radius: 50%;
|
||||||
|
box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulse {
|
||||||
|
from {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<h1>500</h1>
|
||||||
|
<h2>Internal Server Error</h2>
|
||||||
|
<img src="https://via.placeholder.com/300x300?text=Error" alt="Error Image" class="error-image">
|
||||||
|
<p>Something went wrong on our end. We're working on fixing it!</p>
|
||||||
|
<p>Please try again later, or reload the page.</p>
|
||||||
|
<a href="javascript:location.reload()" class="reload-link">Reload Page</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
Reference in New Issue
Block a user