A
A
Andrey Salnikov2017-07-19 14:00:58
Django
Andrey Salnikov, 2017-07-19 14:00:58

How to run multiple sites on one Django?

The essence of the problem is this. The client wants 5 sites that will be linked by various elements.
There is 1 "main" site (just like a business card site) and 4 others (like shops). At the same time, they must have a common authorization, a common basket.
The following functionality should also be implemented:
On the "main" site if there is a huge portfolio. It is necessary that the client in the admin panel of this site indicates on which sites this work can be displayed. Other sites could pick it up. But they themselves could add too. That is, the work should be carried out with 1 model.
It was decided to do this using the sites Framework, which is in django.
In general, there are such questions:
1) are there at least some similar examples of solving this problem?
2) How to organize the separation of all these sites? All of them with different layouts, their own styles, etc.
3) How to organize the project structure? Everything should be in 1 folder, divided into applications?
4) How to organize url?
5) how to develop all this with the help of runserver? And can it be done at all?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Yermolayev, 2017-07-19
@yermocode

I solved a couple of similar problems on ruby ​​on rails + passenger, for one of them roughly 5 rails applications were created hosted on one server (each with its own domain), one of them was the "main" site with a personal account from which the content was updated on other 4 sites, the essence was this: all interactions took place via the API, any changes were tracked using websocket (it was necessary to monitor all activities in real time). This is, in short. I think it will not be difficult to build such an architecture on django. For another task, it was necessary to build a web application on one domain, but there had to be the functionality of creating the n-th number of "separate" sites with a common personal account. In this case, the problem was solved with the help of routing (routes), roughly speaking:

//это был роут на основной сайт
scope module: :mainClient do
    root to: 'index#home'
end

//роуты на остальные "подсайты"
namespace :subSite_1 do
    root to: 'index#home'
end

namespace :subSite_2 do
    root to: 'index#home'
end

in this case, each "subsite" including the "main" had its own view, style, script. I didn’t write on django, but I think the logic will not change much from this.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question