First python flask Addon with Ingress

Hello,

I am testing my first add-on in Python Flask with Ingress.

For now, this add-on does nothing; I just have two routes, a ‘/’ and ‘log’ called from the first one.

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/log/<service>')
def log(service):
    log = [
        "2024-06-10 13:41:07,099 INFO Publish MQTT topic home/flowmeter/elechpjr/month/flow = 0.0",
        "2024-06-10 13:41:07,099 INFO Recu MQTT message: home/teleinfo/linky/tempo/elechall (0) = b'21604912'",
        "2024-06-10 13:41:07,099 DEBUG Sensor: 'linky elechall' = 21604912",
        "2024-06-10 13:41:07,099 DEBUG Compteur elechall courant: 21604912 et précédent: 21604878",
        "2024-06-10 13:41:07,099 DEBUG Send elechall MQTT message",
        "2024-06-10 13:41:07,099 INFO Publish MQTT topic home/flowmeter/elechall/current/flow = 0.0340",
    ]
    return render_template('log.html', titre="vesta flowmeter2mqtt log", loglist=log)

I am using Bootstrap, so I have a JS and a CSS file in the static directory.

$ find root/static
root/static
root/static/css
root/static/css/bootstrap.min.css
root/static/js
root/static/js/bootstrap.bundle.min.js

The two HTML pages call the two JS/CSS files as follows:

<link href="static/css/bootstrap.min.css" rel="stylesheet">
<script src="static/js/bootstrap.bundle.min.js"></script>

While the main page displays correctly using the Bootstrap js/css files, the log page called from the main page cannot access these two files.

Ingress searches for them in the link /log/static/js/bootstrap.bundle.min.js and not /static/js/bootstrap.bundle.min.js.

Log add-on:

2025-12-27 13:51:01 local-serviceslog werkzeug[100] INFO 172.30.32.2 - - [27/Dec/2025 13:51:01] "GET / HTTP/1.1" 200 -
2025-12-27 13:51:01 local-serviceslog werkzeug[100] INFO 172.30.32.2 - - [27/Dec/2025 13:51:01] "GET /static/css/bootstrap.min.css HTTP/1.1" 304 -
2025-12-27 13:51:01 local-serviceslog werkzeug[100] INFO 172.30.32.2 - - [27/Dec/2025 13:51:01] "GET /static/js/bootstrap.bundle.min.js HTTP/1.1" 304 -
2025-12-27 13:51:05 local-serviceslog werkzeug[100] INFO 172.30.32.2 - - [27/Dec/2025 13:51:05] "GET /log/flowmeter2mqtt HTTP/1.1" 200 -
2025-12-27 13:51:05 local-serviceslog werkzeug[100] INFO 172.30.32.2 - - [27/Dec/2025 13:51:05] "GET /log/static/css/bootstrap.min.css HTTP/1.1" 404 -
2025-12-27 13:51:05 local-serviceslog werkzeug[100] INFO 172.30.32.2 - - [27/Dec/2025 13:51:05] "GET /log/static/js/bootstrap.bundle.min.js HTTP/1.1" 404 -

Log dev Firefox:

I have tried several solutions, such as using url_for to load the js/css files as follows:

<script src="{{url_for(‘static’, filename=‘bootstrap.bundle.min.js’)}}"></script>

or modified the static file directory in the code like this:

app = Flask(__name__, static_url_path="/", static_folder=‘./’)

But I still have the problem.
For your information, the code and rendering work fine outside of HA by directly accessing the program’s URL+port.

Do you have any ideas?