i write django package name example and it has dependency to other package like rest-frame work. i want
to my dependencies be added to installed app of project that using this app, text,ihave seen this question and answers but i want to add the dependencies to setting not make the user manually add them.
so is it possible to add them to INSTALLED_APPS ?
i have try :
from django.apps import AppConfig
class MyPackageAppConfig(AppConfig):
name="example_package"
def ready(self):
import importlib
from django.apps.registry import apps
for dependency in self.get_dependencies():
try:
importlib.import_module(dependency)
except ImportError:
pass
def get_dependencies(self):
# Define your package's dependencies
dependencies = [
'django-foo',
'django-bar',
]
return dependencies
but it didnt work i also try this:
from django.apps import AppConfig
class MyPackageAppConfig(AppConfig):
name="example"
def ready(self):
from django.conf import settings
# Add your package to INSTALLED_APPS
settings.INSTALLED_APPS.append("django-foo")
and in both case i add them to my inint.py file to run