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

185
Vistas
install multiple apps by one entry in INSTALLED_APPS in django (dependency)

is the concept of dependencies available in Django apps too?

For example, let's say I'm building my own custom Django app "polls" that can be reused in any Django project.

so whenever you need to add it to a project, you will have to add

INSTALLED_APPS = [
    ...
    'polls.apps.PollsConfig',
]

but let's also say, that this polls app depends on the Django REST Framework, so whenever you use it, you will have to add that as well

INSTALLED_APPS = [
    ...
    'polls.apps.PollsConfig',
    'rest_framework',
]

And how about if it depends on even way more apps, do I have to list them all again in the settings.py of each and every project?

Or, is there some way to add rest_framework as an installed app inside the apps.py of the polls app so that it's automatically installed whenever polls is installed on a project?

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

0

The pluggable apps cant override the host project's settings. We can add more checks and validations to the apps before the project run.


FYI: to validate the presence of the dependency package, we can make use of the ready(...)--(DOC) method of PollsConfig class as,

from django.contrib.admin.apps import AdminConfig


class PollsConfig(AdminConfig):

    def ready(self):
        try:
            import rest_framework
        except ImportError:
            raise ValueError("Missing 'rest_framework' from 'INSTALLED_APPS'")
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