How can I get path of 3rd party app in Django settings.py

260 views Asked by At

I install django_celery_beat app in Django settings.py file

INSTALLED_APPS = [
...,
'django_celery_beat',

]

It has its own locale dir.

enter image description here

As I understand I need to add this path to LOCALE_PATHS in settings.py. How can I get it? Hardcoding is not an option, of cause.

1

There are 1 answers

0
Konstantin Smolyanin On BEST ANSWER

So I found the following solutions that works:

import importlib

LOCALE_PATHS = [
    ...,
    os.path.join(        
        os.path.dirname(importlib.util.find_spec('django_celery_beat').origin),
        'locale/',
    ),
]