Flask-AppBuilder
Flask-AppBuilder copied to clipboard
App Icon Url Broken
Environment: Windows 10 (Non-English)
If I set an app icon in config.py, it only displays correctly on the index page. If I go to another page, like: Security --> List Users, the icon is broken.
Also, the output in the command prompt shows the url is incorrect: INFO:werkzeug:127.0.0.1 - - "GET /users/list/static/img/my_custom_icon.png HTTP/1.1" 404 - The url should be : "/static/img/my_custom_icon.png" It seems like it is joining the path of the view to the path for the app icon.
Please let me know if there is a way to fix this.
I'm having the same issue... Going to try to take a look and see if I can fix it.
Edit: It looks like it may have something to do with: appbuilder.get_url_for_index
in the template baselib.html...... Going to adjust some things and test locally.
Any progress on this ? I was checking out Apache Superset, which also uses Flask-Appbuilder, and the icon seems fine. Maybe it is a template coding issue ?
I'm having the same issue... Going to try to take a look and see if I can fix it.
Edit: It looks like it may have something to do with:
appbuilder.get_url_for_index
in the template baselib.html...... Going to adjust some things and test locally.
thank your suggest , it can work after change ''flask_appbuilder/templates/appbuilder/navbar.html''
{% if appbuilder.app_icon %} <a class="navbar-brand" href="{{appbuilder.get_url_for_index}}"> <img src="{{appbuilder.get_url_for_index}}{{appbuilder.app_icon}}" height="100%" width="auto"> <!--change this line--> </a>
Adding a forwardslash to the logo path in config.[y resolved the issue for me:
In config.py:
APP_ICON = "static/img/logo.jpg" --> issue as described above. Only works on the index.html
APP_ICON = "/static/img/logo.jpg" --> issue resolved. Logo appears on all pages.
this is still a question isn't it any solution ?
I'm having the same problem. Regarding Superset, they have APP_ICON = "/static/assets/images/superset-logo-horiz.png"
but the icon is in the folder superset-frontend/images
. I'm new to FAB, is this s a bug or can someone explain what's going on here. Thx!
I saw the log message on my command line console.
127.0.0.1 - - [24/Nov/2022 22:00:19] "GET /app/static/img/app_icon.ico HTTP/1.1" 404 -
So, I think need to settings a route path for APP, after that I change settings to APP_ICON = "/static/img/app_icon.ico"
127.0.0.1 - - [24/Nov/2022 22:00:44] "GET /static/img/app_icon.ico HTTP/1.1" 200 -