Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

159
Vistas
Django & React: Connecting multiple apps from one template

Good morning,

I would like to ask, if it's possible to connect multiple apps in django, each using his own react frontend? For example: I have one main page that holds all the links to the different applications...

Folder-Structure:

|- project
|    |- app_main
|    |    |- templates
|    |    |   |- app_main
|    |    |   |   |- main.html
|    |- app_1
|    |    |- frontend_1 (react)
|    |    |   |- public
|    |    |   |    |- index.html
|    |- app_2
|    |    |- frontend_2 (react)
|    |    |   |- public
|    |    |   |   |- index.html

As I understood - or at least I think so -, the folder holding the html-files have to be included inside the template in settings.py...

settings.py

REACT_ROUTE_APP_1 = os.path.join(BASE_DIR, 'app_1', 'frontend_1', 'public')
REACT_ROUTE_APP_2 = os.path.join(BASE_DIR, 'app_2', 'frontend_2', 'public')

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            REACT_ROUTE_APP_1,
            REACT_ROUTE_APP_2
        ],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

Is this the right way or is there a much better solution? And if it's the right choice, how can I connect the url-route inside my ?

main.html

<div>
    <a href="?">Link to App 1</a>
    <a href="?">Link to App 2</a>
</div>

Even though I thought Django & Reactwould be a popular combination, I found only a few related articles!

Thanks for your help and advice and have a great week!

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Your folder structure is fine , you should use the URL router to redirect from main app to other apps

main urls.py

urlpatterns = [
    path("", include('main.urls')), 
    path("app_1/", include('app_1.urls')), 
    path("app_2", include('app_2.urls')), 

]

And in your app_1 urls.py :

urlpatterns = [
   path('',(TemplateView.as_view(
      template_name="app_1/index.html",
  )), name='index.html'),
]

html


<div>
    #URI + "app_1"
    <a href="app_1">Link to App 1</a>
</div>

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda