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.

app.py 1.5KB

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