Search code examples
djangodjango-i18n

How to set LOCALE_PATH relative to project path in Django?


In the development environment, I set locale paths to:

LOCALE_PATHS = (
'/Users/***/Documents/Projects/**/Server/Django/**/locale',
)

But when I deploy it to server, locale path shold be changed.

How can I handle this?


Solution

  • to settings add

    import os
    
    LOCALE_PATHS = (
        os.path.join(os.path.dirname(__file__), "locale"),
    )