Webinterface using wsgi - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26) +--- Thread: Webinterface using wsgi (/showthread.php?tid=377228) |
Webinterface using wsgi - Millencolin007 - 2024-04-23 I have a small webinterface addon of type wsgi. It doesn't work anymore since the update to Kodi 21 (tried on ubuntu and windows). Kodi crashes immediately when I try to access the webinterface on http://localhost:8080/addons/webinterface.helloworld/ The only line I can see in the kodi log is 2024-04-23 22:32:15.432 T:231 info <general>: -->HTTP Python WSGI Interpreter Initialized<-- The problem can be reproduced using the following minimal addon consisting of addon.xml and app.py
RE: Webinterface using wsgi - pkscout - 2024-04-25 I'm replying only to say that I can confirm this on Kodi 21 running on MacOS. Let me see if I can get someone to take a look at this. RE: Webinterface using wsgi - Roman_V_M - 2024-04-26 I had my suspicions that the built-in WSGI server is broken. Not sure if it can be fixed soon. As a workaround you can create a service addon that will host your web UI using Python's built-in wsgiref server. The only tricky part is that your server must gracefully close when Kodi shuts down. A minimal example: Code:
You need to replace demo_app with your own Bottle app. RE: Webinterface using wsgi - Millencolin007 - 2024-04-26 Thanks for the feedback. As a workaround it was enough to switch the type of the addon from webinterface to service and adding the following line at the end of the app.py to start the bottle server Code: app.run(host='0.0.0.0', port=8090) Obviously this is not as nice as having it integrated as a webinterface since I need to run it on a different port and bypasses authentication RE: Webinterface using wsgi - Roman_V_M - 2024-04-26 (2024-04-26, 18:48)Millencolin007 Wrote: Thanks for the feedback.As I noted above, the problem with using this approach is that Kodi won't be able to gracefully terminate your web server. handle_request() in a loop with checking Kodi abort flag is the correct approach. BTW, you can configure your own authentification if needed. |