How to make Flask communicate with Flask across two different machines?

前端 未结 1 667
再見小時候
再見小時候 2021-01-27 02:31

I have a Flask app on one machine, and a second machine where some queries are required to be run from. The second machine doesn\'t render any pages, it will just be doing thin

1条回答
  •  清歌不尽
    2021-01-27 03:23

    You communicate with it like you would any other HTTP server: by making HTTP requests. Python has the built-in urllib, or you could consider the easy to use requests library.

    If all the second machine is doing is running background tasks, there's no reason to set up another Flask app. You can use a task queue such as Celery instead, or an RPC library such as Pyro.

    0 讨论(0)
提交回复
热议问题