I'm writing a quick Django module and want to check for another module. Is there's a shortcut to check if another module is in the INSTALLED_APPS
list in Django's settings?
from settings import INSTALLED_APPS
if 'appname' in INSTALLED_APPS:
print 'we have app'
And this way is somewhat how Django itself does. Also check the load_app
method on the linked page.
Django contains a registry of installed applications that you can use for this purpose:
>>> from django.apps import apps
>>> apps.is_installed("django.contrib.admin")
True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With