def load_product_details(self): """Fetch product details, if we don't already have them.""" from product_details import product_details if not product_details.last_update: log.info('Product details missing, downloading...') call_command('update_product_details') product_details.__init__() # reload the product details
#!/usr/bin/env python import os import sys os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") import setup_olympia # noqa # No third-party imports until we've added all our sitedirs! from django.core.management import (call_command, execute_from_command_line) # noqa if __name__ == "__main__": # If product details aren't present, get them. from product_details import product_details if not product_details.last_update: print 'Product details missing, downloading...' call_command('update_product_details') product_details.__init__() # reload the product details execute_from_command_line(sys.argv)
# Import for side-effect: configures our logging handlers. # pylint: disable-msg=W0611 from lib.log_settings_base import log_configure log_configure() newrelic_ini = getattr(settings, "NEWRELIC_INI", None) load_newrelic = False if newrelic_ini: import newrelic.agent try: newrelic.agent.initialize(newrelic_ini) load_newrelic = True except: startup_logger = logging.getLogger("z.startup") startup_logger.exception("Failed to load new relic config.") if __name__ == "__main__": # If product details aren't present, get them. from product_details import product_details if not product_details.last_update: print "Product details missing, downloading..." call_command("update_product_details") product_details.__init__() # reload the product details execute_from_command_line(sys.argv)