You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. from flask import Flask, render_template
  2. from flask_sock import Sock
  3. import flask
  4. import hot_reload_mod_i2
  5. import gmod
  6. # app = Flask(__name__)
  7. app = Flask(__name__,template_folder = r"../js_client")
  8. sock = Sock(app)
  9. gmod.glob["sock"] = sock
  10. gmod.glob["app"] = app
  11. class Eobj():
  12. pass
  13. eobj = Eobj()
  14. gmod.gx =eobj
  15. import rld_m0
  16. import rld_m1
  17. import rld_m2
  18. import rld_m3
  19. # import rld_m4
  20. # import rld_m5
  21. p=print
  22. @app.route('/')
  23. def index():
  24. print("::::::::::::::;")
  25. # return render_template('jsyncdb_index_v5.html')
  26. return render_template('index.html')
  27. # r'''
  28. @app.route('/shared_libs/<path:path>')
  29. def send_report2(path):
  30. return flask.send_file('templates/jquery-3.5.1.min.js')
  31. @app.route('/<path:path>')
  32. def send_report(path):
  33. return flask.send_from_directory('templates', path)
  34. # return flask.send_from_directory('./', path)
  35. # '''
  36. @sock.route('/echo')
  37. def echo(sock):
  38. while True:
  39. data = sock.receive()
  40. sock.send(data)
  41. # @sock.route('/echo_c1')
  42. # def echo_coll(sock):
  43. # p("echo_coll app")
  44. # while True:
  45. # data = sock.receive()
  46. # sock.send(data)
  47. # @sock.route('/<path:path>')
  48. # def echo23(sock,*a,**kw):
  49. # p("E2",a,kw)
  50. # while True:
  51. # data = sock.receive()
  52. # sock.send(data)
  53. # for en in dir(sock):
  54. # p(en)
  55. # p("echo23",echo23)
  56. # p("~83293298383838383")
  57. r'''
  58. for en in dir(sock):
  59. print(".",en)
  60. for en in dir(app):
  61. print("~",en)
  62. '''
  63. import inspect
  64. print("APP_ORIG",sock.route)
  65. print("APP_ORIG",app.route)
  66. print("APP_ORIG",inspect.getfile(app.route))
  67. print("APP_ORIG",app.url_map)
  68. if __name__ == '__main__':
  69. pass
  70. # socketio.run(app, debug=True)
  71. app.run(debug=True,host='0.0.0.0')
  72. # sock.run(app,host='0.0.0.0', debug=True,allow_unsafe_werkzeug=True)