简体   繁体   中英

How to connect python script as a server with python and javascript apps as client?

The task is to connect next entities somehow:

  • Python scripts on Ubuntu (server) - doing something on schedule and by calling
  • Python script on Windows (client) - simply send command to server and recieve "answer"
  • Android js-built app (cordova) - same purpose as windows-client
  • Database - stores all commands from clients and answers from server

I'm thinking in way of something what will trigger any database changing

(client->db, db->server-server->db, db->client)

but I don't know is it real and is it right solution. Maybe here is another and more straightforward way

There are a number of easy to use and well documented Python frameworks for setting up web applications (which I would venture, is going to be the easiest way to achieve what you are trying to do)

Flask - http://flask.pocoo.org/ has extensive documentation, a large user base and not at all intimidating new users, while powerful enough to build most kinds of web-based things on. You can use Flask to expose functionality on your server via standard HTTP requests, which will make accessing them from your windows and android clients trivial.

Flask also plays very nicely with sqlalchemy, so getting a database behind your application should be relatively easy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM