I want to use one app in Django and different settings.

Asked 2 years ago, Updated 2 years ago, 77 views

I am creating an application on Django.
Depending on the client, we are considering operating in a subdomain.
It is not efficient to install the same application on the system, so we are considering the following configuration.

<Configuration in mind>
I want to use different settings files for one app by subdomain.

I was wondering if I should set the INSTALLED_APPS application to pass to the location where the application is located, but I couldn't make it easy, so I put my hands up><.

Is it possible to operate these settings?
Also, if possible, what kind of settings do I need?

I'm sorry to bother you at such a busy time, but
I would appreciate it if you could let me know.

django

2022-09-30 18:14

1 Answers

I'm not sure if it can be applied to the current Django because the article is old as 2010, but Apache and WSGI seem to be able to do it.

How to run multiple websites from one Django project

It may be useful to run two or more website or site subdomains from a single Django codebase.Each Django app in the project can access websites in different domains, but all apps can share a single database through a single management interface.

To achieve this, each website must have a separate WSGI socket.You can provide a separate settings.py file for each website to select which app to activate on that site and which urls.py file to ROOT_URLCONF to route requests to that domain.

This example shows how to set up two subdomains for a site running on the WebFaction hosting service:

Below is an explanation of the following items.See the link for more information.

preparation

Configuring Apache

WSGI startup files

settings.py file

urls.py file

Conclusion


2022-09-30 18:14

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.