How to connect Django and .net core project as a single application?

I want to connect Django project and .NET core project because I want it take advantage of good library available in python so I will make one strong .NET core project.so through some lite on it.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I am afraid there is no way to run both Django/Python and .Net/C# in a same process. But there are at least one other option.

The options is using MicroService architecture. That means you create two separate projects, one for .Net and another for Django/Python. Then make these two projects talk to each other.

They can communicate with each other in several ways. Most common way is to communicate via REST. It means each project provide the other side a bunch of APIs. The other side can consume (call) the API to receive or send the required data.

Another way to communicate is to use a shared database. Another one is use messaging solutions like RabbitMQ.

In MicroService architecture, you can host each one on a convenient web server or, if you enjoy fancy technologies, you can use docker.

Update

A practical example would be like this:

  1. Your Python side has the functionality of calculating direct distance between point A and B.
  2. You create a Django app with a REST API called calc
  3. It get A and B as via query string. Just like http://localhost:5000/api/calc?lata=53.123&longa=34.134&latb=53.999&longb=34.999 (consider a and b in query parameters)
  4. Create a .Net app wither as web or desktop
  5. With the .Net app, call calc api via utilities like HttpClient
  6. Now, you have the results in your .Net part


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x