micropython-web
Not logged in

Another micro web-framework for MicroPython.

This one has more separation between the software layers :

  • HTTP server,
  • Servlet-like application routing,
  • a few demonstration "applications" (one to serve static files),
  • a Flask-inspired application framework, with URL routing and parameter capture
  • and an efficient Mustache-type templating engine.

Hence it should be more modular regarding memory usage.

It also

  • speaks HTTP/1.1,
  • is generally optimized to reduce memory usage, but is quite fast after all in this context
    • e.g. on MPY 1.20 HTTP serving uses 17-18 KB, the full framework uses about 25-28K plus the application
    • only the structure of a template is stored in memory after start, so that each template uses only a few dozen bytes of RAM
    • each request needs between 0.5 and 1.25 KB for buffers and meta-information, including a possible output buffer if required
  • leverages uasyncio : can handle several requests at a time, if enough memory;
  • has chunking : when body length is unknown
  • has body streaming : the response body does not have to fit in memory (only headers and current chunk)