Python Flask routing return 404 in my hosting


I’ve got an issue in terms of using send_from_directory in my :

from flask import Flask, render_template, request, jsonify, send_from_directory
import json

app = Flask(__name__)

def home():
    return render_template("index.html")

@app.route("/newIndex", methods=["GET", "POST"])
def newIndex():
    Appdata = extractApp(appUrl)

    filename = Appdata["nama_file"].replace("./static/assets/save\\", "")
    permitted_directory = "static/assets/save/"
    return send_from_directory(
        directory=permitted_directory, path=filename, as_attachment=True

def riwu():
    return "<h1>ini test saja 123</h1>"

However, when i deploy to my hosting (using centos 7 in Cpanel), the @app.route(“/”) it’s works as well as if i type manually in http://[my_website]/riwu. but not for @app.route(“/newIndex”).

it shows error “Not found”.

I already setup the .htaccess and httpd.conf to change value from :

<Directory /var/www/html/public>
    AllowOverride None


<Directory /var/www/html/public>
    AllowOverride All

but still does not work.

I’ve tried in my local server using Visual Code (Windows 10) and it’s works normally.

note : @app.route(“/newIndex”) is does not have any redirect new html. It just to download file from send_from_directory.

is there any configuration that i missed?