Answer the question
In order to leave comments, you need to log in
Does it make sense to separate the main site and its API?
Hello. Let's say I have a Django website and I want to write an API to create an android application. Does it make sense to separate these parts? That is, for example, the link mysite.com/create_map will be a regular site, in jung. And, for example, for api.mysite.com/methods/create_map I will deploy some kind of starlette? It turns out, all of a sudden, if dzhanga wants to block the thread somewhere, even for half a second, the api's work will not slow down. And thanks to asin, it will work faster than django rest framework. Or am I wrong somewhere?
Answer the question
In order to leave comments, you need to log in
And thanks to asin it will work faster than django rest framework
Let's say how many visitors per hour do you have? ten? fifteen? Can you imagine how much effort you have to put in to maintain two versions of the code? Will you write out the names of the dzhangi tables manually in SQL? Or will you keep the second circuit for alchemy and synchronize it every time? Don't be fooled, a couple of additional server cores and correctly written queries to the database will cost much less than months of your work.
You need to separate because the site needs one thing, and the android application needs another.
1) Dzhanga needs to be hung on one container (conditional interface)
2) API needs to be moved to another container (for example, you can use FastApi which is just based on Starlette).
3) Make sure that both containers look at the same database (or make a replica of the main database for FastApi)
4) Next, Tortoise ORM is connected to the FastApi container.
As to whether it will be faster, tests will best answer you.
https://www.techempower.com/benchmarks/
PS.
In general, separating the API from the conditional interface and putting it in a separate container (s) is a common practice and this is how it should be done.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question