Sometimes it's nice to use FastUI's python integration with local copies of the js/css files:
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
import fastui
app = FastAPI()
# make sure you have a folder named 'static' in your project and put the css and js files inside a subfolder called 'assets'
app.mount("/static", StaticFiles(directory="static"), name="static")
# configure fastui to use these local css and js files instead of the ones on the CDN
fastui._PREBUILT_CDN_URL = f'/static/assets'
...
Sometimes it's nice to use FastUI's python integration with local copies of the js/css files:
Instructions might look something like:
Using Local Copies of the JS/CSS files:
Place
index.jsandindex.cssin a folder under your fastapi/flask project where you serve static files, for example inside astatic/assetsfolder.Configure fastapi and fastui as something like the following. Note that the key is to set the
fastui._PREBUILT_CDN_URLvariable that fastui uses for defining the location of the JS/CSS files, when generating the HTML pages.