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: 2072
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 :)

Post Reply