Deploy Flask application

Hello everyone! Please help me.
I get a 404 error when deploying Flask on Hestia cp
.htaccess looks like this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ server.py/$1 [QSA,L]

server.py looks like this:

from flask import Flask, request, jsonify, send_from_directory, url_for
from flask_cors import CORS, cross_origin
from functools import wraps
import database
import os
from werkzeug.utils import secure_filename

app = Flask(__name__, static_folder="build/static")
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'

def check_required_keys(dictionary, keys):
    errors = []
    for key in keys:
        if key not in dictionary:
            errors.append(f"{key} is required")
    return errors


def token_required(func):
    @wraps(func)  # Добавляем декоратор для сохранения имени функции
    def wrapper(*args, **kwargs):
        token = request.headers.get("Authorization")
        if not token:
            return jsonify({"errors": ["Missing token"]}), 401
        if not token.startswith("Bearer "):
            return jsonify({"errors": ["Invalid token type"]}), 401
        # Удаляем префикс Bearer и пробел
        token = token[7:]
        is_token = database.token_exists(token)
        if not is_token:
            return jsonify({"errors": ["Invalid token"]}), 401
        return func(*args, **kwargs)
    return wrapper


@app.route('/', methods=['GET'])
def index():
    try:
        return send_from_directory('build', "index.html")
    except:
        return "<h1>Страница не найдена</h1>"


@app.route('/api/users', methods=['POST'])
@cross_origin()
def users():
    data = request.get_json()
    errors = check_required_keys(data, ['name', 'username', 'email', 'password'])
    if len(errors) > 0:
        return jsonify({"errors": errors}), 422
    else:
        ok, error = database.register_user(data['name'], data['username'], data['email'], data['password'])
        if ok:
            return jsonify({"message": "User added successfully"}), 201
        else:
            return jsonify({"errors": [error]}), 422
            

@app.route('/api/login', methods=['POST'])
@cross_origin()
def login():
    data = request.get_json()
    errors = check_required_keys(data, ['login', 'password'])
    if len(errors) > 0:
        return jsonify({"errors": errors}), 422
    else:
        token = database.get_token(data['login'], data['password'])
        if token:
            return jsonify({
                "message": "User logged in successfully",
                "token": token
                }), 200
        else:
            return jsonify({"errors": ["Invalid login or password"]}), 401


@app.route('/api/profile', methods=['GET'])
@cross_origin()
@token_required
def profile():
    user = database.get_user(request.headers.get('Authorization')[7:])
    if user:
        return jsonify({"data": user}), 200
    return jsonify({"errors": ["User not found"]}), 404
    


@app.route('/api/upload', methods=['POST'])
@cross_origin()
@token_required
def upload_file():
    if request.method == 'POST':
        errors = check_required_keys(request.files, ['file'])
        if len(errors) > 0:
            return jsonify({"errors": errors}), 422
        file = request.files['file']
        filename = secure_filename(file.filename)
        file_path = os.path.join('media', filename)
        file.save(file_path)
        file_url = url_for('serve_file', filename=filename)
        return jsonify({"data": file_url}), 201
 
@app.route('/files/<filename>')
@cross_origin()
def serve_file(filename):
    return send_from_directory('media', filename)

# Запуск сервера
if __name__ == '__main__':
    database.create_tables()
    if not os.path.exists('media'):
        os.makedirs('media')
    app.run()

geekly.wsgi:

import sys
sys.path.insert(0, '/home/web/geekly.nazarov-do-it.ru/public_html')

from server import app as application

I have the following files in home/web/geekly.nazarov-do-it.ru/public_html:
venv
media
.htaccess
database.db
database.py
geekly.wsgi
robots.txt
server.py