Building a web application, Django or add to LuCI

Hi, I have a standalone app written in Python+GTK which i want to move to a web based app, running on an OpenWrt device: an 8devices Centipede with an AR9331, 16 MB Flash and 64 MB RAM.
I'm looking into Python+Django but that may well be too heavy for this hardware. I see there is a Django package for OpenWrt but no further information. Has anybody tried this?
I'm wondering if it would be a good idea to just use the LuCI framework and call my Python functions with luci.sys.call() - or is there a better way to use Python code with LuCI?
Thanks much for any advice.

Depends on a few things...

  1. resources on the device
  2. OpenWrt version your running
  3. python version your running
  4. python complexity
  5. system interaction ( getting or setting of higher level or openwrt runtime state ) and whether that is luci/ubus related ...

Like you mention, the footprint is often the principle caveat with python... and any footprint reduction will probably lead back to your code, not luci.

Hi, thanks for your message. Indeed i'm finding out that the device resources are the bottleneck: my 16Mb of Flash are not sufficient to install python3+django.
I'm running OpenWrt 18.06.4 which leaves about 11Mb available.
The openwrt django package seems to be version 1.8.19 (EOL 2018) and when i installed it via opkg it filled up my flash with a full install of python2.7
I realised i had to install "python3-pip" first, to get Django via pip3. With a fresh OpenWrt install, the "opkg install python3-pip" also filled up the 11Mb, with the full python3. But then i can see "pip3 install Django" attempts to install version 2.2.6 (downloading 7.5Mb) so I guess i need to try again on a system with more flash space, and it may work. I don't think i can trim the python3 install to make enough space available.

possibly-dated-mmc-over-gpio guide if you happen to try it ( start with a fresh install ).... for the last step, follow the extroot setup procedure and mount it on overlay

if the python is mostly for generic pinctrl... try tracking down a few e x i sting C options... very lightweight for common needs.