1

I have two separate Django projects and want to locate them in 2 different servers. Is there a way to communicate with each other? In one projects I need to be able to upload a file and send it to second project for processing.

Arthur
  • 109
  • 8

2 Answers2

0

It's called service discovery. read more about it here: https://microservices.io/patterns/server-side-discovery.html

Kasra Sh
  • 21
  • 2
0

basically you can just use python request library:

import request

files = {'upload_file': open('file.txt','rb')}
values = {'DB': 'photcat', 'OUT': 'csv', 'SHORT': 'short'}

r = requests.post(url, files=files, data=values)

and the response from the other server can be for example json with urls to the files, or something...
check python requests file upload

but be careful, you should send some hashes/keys or something so other people can't imitate the behavior and send you false data. That ofc depends on what you need it for

BeryCZ
  • 137
  • 4