-
Notifications
You must be signed in to change notification settings - Fork 87
Description
In issue #623 , @newexploder found and fixed a CSS issue where the files weren't getting loaded correctly. Weird that it happened on his/her machine only (so far), but the fix should probably be applied to the app code as it's very fast.
Borrowing from the notes in that issue:
Root Cause
The root cause was an incorrect MIME type being served for the CSS files.
- Expected
Content-Type:text/css - Actual
Content-Typeserved:application/x-css
The Solution
The issue was resolved by adding two lines of code to the application factory file (lute/app_factory.py) to explicitly register the correct MIME type for CSS files within the Python environment.
-
Add the
mimetypesimport to the top of the file:import mimetypes
-
Add the following line after all the imports, before the
create_app()function:mimetypes.add_type('text/css', '.css')
After adding this code and restarting the server, the CSS is now served with the correct text/css MIME type, and the application's layout renders perfectly.
This should be a very fast fix.