Microdot cann't read local css files

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
draco.wang
Posts: 4
Joined: Tue Nov 03, 2020 3:18 am

Microdot cann't read local css files

Post by draco.wang » Tue Nov 03, 2020 3:25 am

Hi guys,
I am using microdot as the web server on ESP32, according example gpio.html: href="https://stackpath.bootstrapcdn.com/boot ... ap.min.css" , i downloaed the css file to local, and change the code to :
href="bootstrap.min.css" , after running got error message:
GET bootstrap.min.css 404

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Microdot cann't read local css files

Post by jimmo » Tue Nov 03, 2020 3:46 am

draco.wang wrote:
Tue Nov 03, 2020 3:25 am
GET bootstrap.min.css 404
The example doesn't have any code in it to respond to anything other than "/" (where it returns gpio.html for a GET, and handles the form for a POST). You'll need to add a handler for "/bootstrap.min.css" that uses send_file to return the CSS.

draco.wang
Posts: 4
Joined: Tue Nov 03, 2020 3:18 am

Re: Microdot cann't read local css files

Post by draco.wang » Tue Nov 03, 2020 5:56 am

Thank you very much , it worked :)

dubaleeiro
Posts: 7
Joined: Mon Feb 12, 2018 9:52 pm

Re: Microdot cann't read local css files

Post by dubaleeiro » Sun Aug 15, 2021 11:41 am

hey @jimmo, the method you've described worked for me as well, thanks ! However I can't make the Font Awesome working...

I have saved the 'solid.min.css' file in one folder called 'src' (by the way, also where my working css style file is located) and created a handler for that. I addition, I've copied the 'webfonts' folder at the same level as the 'src', as explained here:
https://stackoverflow.com/questions/254 ... -using-cdn

However, the fonts are not being displayed... do I need a handler for each of the files in the 'webfonts' folder? I would appreciate any help on that!

Post Reply