from flask import Flask, render_template from flask_sock import Sock import flask import hot_reload_mod_i2 import gmod import os # app = Flask(__name__) app = Flask(__name__,template_folder = r"../js_client") sock = Sock(app) gmod.glob["sock"] = sock gmod.glob["app"] = app class Eobj(): pass eobj = Eobj() gmod.gx =eobj import rld_m0 import rld_m1 import rld_m2 import rld_m3 # import rld_m4 # import rld_m5 p=print @app.route('/') def index(): print("::::::::::::::;") return render_template('jsyncdb_index_v5.html') return render_template('index.html') # r''' @app.route('/shared_libs/') def send_report2(path): return flask.send_file('../js_client/jquery-3.5.1.min.js') @app.route('/') def send_report(path): # return flask.send_from_directory('templates', path) return flask.send_from_directory(r"../js_client", path) return flask.send_from_directory('./', path) # ''' @sock.route('/echo') def echo(sock): while True: data = sock.receive() sock.send(data) # @sock.route('/echo_c1') # def echo_coll(sock): # p("echo_coll app") # while True: # data = sock.receive() # sock.send(data) # @sock.route('/') # def echo23(sock,*a,**kw): # p("E2",a,kw) # while True: # data = sock.receive() # sock.send(data) # for en in dir(sock): # p(en) # p("echo23",echo23) # p("~83293298383838383") r''' for en in dir(sock): print(".",en) for en in dir(app): print("~",en) ''' # generated by bing seems to work @app.route("/ldir") def list_directory(): # Get the list of files and directories # items = os.listdir(DIRECTORY_PATH) items = os.listdir("../js_client") # Filter out hidden files and directories items = [item for item in items if not item.startswith(".")] # Create an HTML string with the list of items as links html_content = "

Contents of the Directory

    " html_links = "" other_links = "" for item in items: p([item]) if "html" in item: html_links += f"
  • {item}
  • " else: other_links += f"
  • {item}
  • " # link = (request.path + '/' if request.path != '/' else '') + item html_content+=html_links html_content+="
    " html_content+=other_links html_content += "
" # Return the HTML content directly return html_content # end generated by bing import inspect print("APP_ORIG",sock.route) print("APP_ORIG",app.route) print("APP_ORIG",inspect.getfile(app.route)) print("APP_ORIG",app.url_map) if __name__ == '__main__': pass # socketio.run(app, debug=True) # app.run(debug=True,host='0.0.0.0') app.run(debug=True,host='0.0.0.0') # sock.run(app,host='0.0.0.0', debug=True,allow_unsafe_werkzeug=True)