Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

176
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda