Skip to content

Instantly share code, notes, and snippets.

@jourdanrodrigues
Last active April 15, 2018 22:59
Show Gist options
  • Save jourdanrodrigues/4b0fd69d9526b641fc060f889365da65 to your computer and use it in GitHub Desktop.
Save jourdanrodrigues/4b0fd69d9526b641fc060f889365da65 to your computer and use it in GitHub Desktop.
A custom "compilemessages" Django 1.11 command to compile only the "LOCALE_PATHS" settings (meant for who uses the environment inside the project).
from django.conf import settings
from django.core.management.commands import compilemessages
class Command(compilemessages.Command):
def compile_messages(self, locations):
# If a received location match a locale set, send to compile
if not any(location[0].startswith(locale) for location in locations for locale in settings.LOCALE_PATHS):
return
super(Command, self).compile_messages(locations)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment