Try to get uhttpd webserver demo running

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
svensche
Posts: 2
Joined: Thu Jan 06, 2022 10:42 am

Try to get uhttpd webserver demo running

Post by svensche » Thu Jan 06, 2022 4:29 pm

My basic goal is to run a tiny webserver on my ESP8266-12F, to read and set some config-parameters for my led-light-pir-pwm-control-program. At the moment I'm trying out uhttpd from https://github.com/fadushin/esp8266.

I'm trying to get the uhttpd demo of https://github.com/fadushin/esp8266/tre ... hon/uhttpd up and running.

I've cross-compiled the modules as descriped in the docs of the project, but after uploading the mpy files to my ESP8266-12F I got stuck with this problem:

Code: Select all


MicroPython v1.17 on 2021-09-02; ESP module with ESP8266

Type "help()" for more information.
>>> import os
>>> os.chdir('www')
>>> f = open('index.html', 'w')
>>> f.write('<html><body>Hello World!</body></html>')
38
>>> f.close()
>>> os.listdir()
['index.html']
>>> import uhttpd
>>> import uhttpd.file_handler
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'uhttpd.file_handler'
>>> server = uhttpd.Server([('/', uhttpd.file_handler.Handler('/www'))])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Server'
>>> import inspect
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'inspect'
>>> dir(uhttp)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'uhttp' isn't defined
>>> dir(uhttpd)
['__class__', '__name__', '__path__']
>>> os.listdir()
['index.html']
>>> os.chdir('/')
>>> os.listdir()
['boot.py', 'uhttpd', 'ulog', 'www']
>>> 

It is the first time cross compiling py files and try to use them. I have no idea whats goind wrong here.

Any help appreciated.

Post Reply