In my base.html
, I currently have two lines to handle both a local (debugging) serving and the remote (production) serving. This is to make sure that one of locations are served. For instance:
<link rel="stylesheet" type="text/css" href="/static/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="/otherroot/static/jquery.dataTables.min.css">
This is of course silly and I am looking for a better solution so I do not get a 404 each time.
I was hoping app.config["APPLICATION_ROOT"]
could help as in Add a prefix to all Flask routes and in the two app.py
files with create_app
and app.run()
I have set the app.config["APPLICATION_ROOT"]
to either '/' and '/otherroot/'.
I have also tried send_from_directory
from How to serve static files in Flask but that neither seems to work.
Update
The first part of base.html
reads
{% extends "bootstrap/base.html" %}
{% block head %}
{{super()}}
<link rel="stylesheet" type="text/css" href="/static/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="/otherroot/static/jquery.dataTables.min.css">
...
Note that the application is also using StaticCDN
which complicate things.