I have multiple python scripts on a VPS running Apache. These use cgi so I make http calls from my front end (VBA in Excel). I believe that this architecture is not optimal. I have installed Flask and am deciding how to call these scripts from Flask.
This is my Flask script:
from flask import Flask, request
appFlask = Flask(__name__)
@appFlask.route('/')
def access_param():
p = request.args['params']
Cmd = p.split("_")
if Cmd[0] == "Test":
from test_01 import Launcher
return (Launcher(Cmd[1:]))
if Cmd[0] == "MOWCommand":
from MOWCommand_06 import MOW
return (MOW(Cmd[1:]))
if Cmd[0] == "ReportSystem":
from Report_System_03 import DoReport
return (DoReport(Cmd[1]))
The url is typically:
http://zzz.zzz.zzz.zzz:5001/?params=MOWCommand_GetClientDetail_10023_2024-03-25_565678
Each of the python scripts have a load of imports to support their functionality, some of them are queries and others do updates. I would appreciate a critical review of my approach.
pmulvey is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.