Reputation: 2982
I have written a python module for extracting archives and processing some data from the extracted files, then optionally deleting the extracted files. Currently I am using it by writing user-code in a separate python script. e.g:
import my_module
with my_module.archive("data.rar") as a:
a.extract()
a.convert("data.csv", "data.xlxs")
a.delete(keep="data.xlsx")
But for non-programmers to use it, I am trying to create a webapp user-interface for it with flask.
What are the best practices for implementing some communication between the user and the module through a webapp? For example
Basically I need to interleave my library code with some user code and I would like the webapp to generate and execute the user-code and to display the output of the processing module.
Upvotes: 0
Views: 86
Reputation: 1597
(I sense a close flag coming since this is a broad topic and it's been a while since "best practices" topics were allowed on SO. )
Based on my on faults I'd recommend to:
requests
, post stuff, check responses, iterate. XMLHttpRequest
(or use jQuery - I am not a big fan of that) for posting stuff. The catch here is that when you post (from the browser), you can define a callback, so you may use the flask response to update the interface.Get ideas from here and here and here and here (just googled for some random pages, some seemed on topic for you).
You probably want to read this too.
Upvotes: 1