P
P
Pavel Echo2020-11-12 11:22:30
Django
Pavel Echo, 2020-11-12 11:22:30

How to organize communication between the 1c database and django?

Good day!
The task was to organize communication between an online store, which is designed in python / django, and 1 with a base. The goal is that once a day, 1s should make a call to the database of the online store, find products by a 6-digit code (the values ​​\u200b\u200bof this field are always the same in both django and 1s), check and 1s should return the values ​​​​of the balances for each product in the database online store.
At the moment, there is an online store database, which, of course, differs in its structure from the 1c database.
The question is: how to approach the solution of this problem and what options exist in general? Suddenly someone faced similar tasks and solved them, please share your solutions.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Shamin, 2020-11-12
@Echofoe

In the general case, the problem of exchanging 1C with a site can be solved as follows.
On the 1C side:
1. We create an Exchange Plan and include in the exchange plan the objects whose changes need to be uploaded to the site
2. We create a Scheduled Task that starts the process of exchanging data with the site once a day or more often
3. We write code for 1C, which we take from the Exchange Plan newly registered changes, serealizes them into a given format - XML ​​or JSON, and sends them to the site server via an HTTPS request.
4. After successfully uploading the data to the site, we receive from the site the number of the receipt that was previously sent to the site. According to the number of the receipt, removes from the registration changes on the exchange plan, because. they are confirmed by the site as accepted.
On the site side:
1. We implement the REST API for interacting with 1C - so that 1C can send and receive data via HTTPS requests.
2. We implement a table for storing receipts for the 1C Exchange Plan
3. We implement parsing of the received data from XML or JSON
4. We implement a record in the database of the received
PS database On the 1C side, you can do without Exchange Plans and upload data by selecting a
request .to. this is an entity for the Exchange Plan.
You can upload one object at a time and remove it from registration in the Exchange Plan immediately after 200 from the site.
There are many options. Depends on the task and requirements.

S
Sgr_A, 2020-11-12
@Sgr_A

1C can interact with third-party systems via WEB or HTTP services. This also includes the organization of the exchange through a file (which, for example, lies on FTP).
It only remains to understand who is the initiator of the call. Either the site polls 1C, or 1C on schedule (regular task) polls the site.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question