Python Forum
Display module variables and edit through webpage - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: Display module variables and edit through webpage (/thread-20370.html)



Display module variables and edit through webpage - freak14 - Aug-07-2019

I am using Flask to implement a web application. My main application has different "modules" I can activate or deactivate by changing the boolean value for that specific module in a dedicated python file that lies in the server directory.

Now I want to show the user on the front-end the different fields with their flags in dropdown menus like that: Module1 : dropdown menu(True, False) And then the user can choose to change the status by setting it to False for example and clicking "save". This click would then set this flag to False in my config file.

Is that possible? And how would I go about implementing it? Right now I don't really care about user access rights. In this scenario I just have one user that wants to change the configuration of the app through the web browser.

Thank you


RE: Display module variables and edit through webpage - fishhook - Aug-08-2019

What are your modules? In the simplest case you can just do something like this:
if myvar1:
   import module1
if myvar2:
   import module2