V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
michaelym
V2EX  ›  Python

如何用 Python 做出可以在前台显示实时计算、运行的结果,例如 IPython NoteBook 这种的。

  •  
  •   michaelym · 2017-01-16 19:50:08 +08:00 · 2394 次点击
    这是一个创建于 2627 天前的主题,其中的信息可能已经有所发展或是发生改变。
    再举个例子,比如用户在前台点击按钮,后台访问 web service 去获取一些数据,然后再以绘图或者其他形式返回到前台给用户。
    5 条回复    2017-01-17 23:22:45 +08:00
    NaVient
        1
    NaVient  
       2017-01-16 19:56:16 +08:00
    用 JS+python 很容易完成啊, ajax 请求数据
    michaelym
        2
    michaelym  
    OP
       2017-01-16 20:01:02 +08:00
    @NaVient 那后台的部分就是直接在 controller 里面调用另外一个 function 去访问外部 service 获得数据么,这样就是觉得时间上面会有一定损耗,还有什么其他好方法么?
    Fen2g
        3
    Fen2g  
       2017-01-17 09:27:04 +08:00
    @michaelym 可以使用 websocket 来实时计算,结果啊
    congeec
        4
    congeec  
       2017-01-17 17:32:34 +08:00 via iPhone
    都提到 notebook 了,看 Jupyter 源码吧, matplotlib 那块儿就是用 tornado with websocket 实现的。代码量不大。
    michaelym
        5
    michaelym  
    OP
       2017-01-17 23:22:45 +08:00
    @Fen2g
    @congeec 前端是个好方法,但后台访问外部 service 这个无法控制,硬要做成同步请求的话是不是没有什么好方案。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4815 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 09:56 · PVG 17:56 · LAX 02:56 · JFK 05:56
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.