add custom 404 page

This commit is contained in:
2025-12-03 06:37:57 +03:00
parent 24fe0aba30
commit 7c037d1593
2 changed files with 10 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
from flask import Flask, session, request from flask import Flask, session, request, render_template
from dotenv import load_dotenv from dotenv import load_dotenv
from .models import Avatars, Users, PostHistory, Posts, MOTD from .models import Avatars, Users, PostHistory, Posts, MOTD
from .auth import digest from .auth import digest
@@ -227,7 +227,7 @@ def create_app():
elif request.path.startswith('/api/'): elif request.path.startswith('/api/'):
return {'error': 'not found'}, e.code return {'error': 'not found'}, e.code
else: else:
return e return render_template('common/404.html'), e.code
# this only happens at build time but # this only happens at build time but
# build time is when updates are done anyway # build time is when updates are done anyway

View File

@@ -0,0 +1,8 @@
{% extends 'base.html' %}
{% block title %}not found{% endblock %}
{% block content %}
<div class="darkbg settings-container">
<h1 class="thread-title">404 Not Found</h1>
<p>The requested URL does not exist.</p>
</div>
{% endblock %}