How to connect Javascript to Python sharing data with JSON format in both ways?

前端 未结 3 1498
没有蜡笔的小新
没有蜡笔的小新 2020-12-07 21:13

I\'m trying to find out how to create a local connection between a Python server and a Javascript client using the JSON format for the data to be retrieved. Particularly, I

3条回答
  •  孤城傲影
    2020-12-07 21:55

    Your question amounts to "how do I make this python into a webservice".

    Probably the most lightweight ways to do that are web.py and flask. Check them out.

    If this is getting bigger, consider django with tastypie - that's a simple way to make a json-based api.

    Update: Apparently, there is also a python-javascript RPC framework called Pico, to which Felix Kling is a contributor. The intro says:

    Literally add one line of code (import pico) to your Python module to turn it into a web service that is accessible through the Javascript (and Python) Pico client libararies.

提交回复
热议问题