def djpl_compilemessages(): """ Compile messages hook for django_productline, this task checks for the activated languages in settings.LANGUAGES. It runs the standard django compilemessages management command with the -l parameter. Example language setting: LANGUAGES = [ ('en', 'English'), ('de', 'Deutsch') ] Remarks: - Each argument for the management command MUST be a single list item, e.g. ['compilemessages', '--locale', 'en'] - The compilemessages command MUST be executed in the projects root dir, so the CWD is adjusted before running this command. :return: """ from django.conf import settings if hasattr(settings, 'LANGUAGES') and len(settings.LANGUAGES) > 0: # changing cwd to project root os.chdir(os.path.join(os.environ['APE_ROOT_DIR'], os.environ['CONTAINER_NAME'])) languages = list() # collect the language abbreviations for language in settings.LANGUAGES: languages.append(language[0]) args = ['compilemessages'] # extend the arg list by the -locale argument for each language for lang in languages: args.extend(['--locale', str(lang)]) tasks.manage(*args)
def djpl_compilemessages(): """ Compile messages hook for django_productline, this task checks for the activated languages in settings.LANGUAGES. It runs the standard django compilemessages management command with the -l parameter. Example language setting: LANGUAGES = [ ('en', 'English'), ('de', 'Deutsch') ] Remarks: - Each argument for the management command MUST be a single list item, e.g. ['compilemessages', '--locale', 'en'] - The compilemessages command MUST be executed in the projects root dir, so the CWD is adjusted before running this command. :return: """ from django.conf import settings if hasattr(settings, 'LANGUAGES') and len(settings.LANGUAGES) > 0: # changing cwd to project root os.chdir( os.path.join(os.environ['APE_ROOT_DIR'], os.environ['CONTAINER_NAME'])) languages = list() # collect the language abbreviations for language in settings.LANGUAGES: languages.append(language[0]) args = ['compilemessages'] # extend the arg list by the -locale argument for each language for lang in languages: args.extend(['--locale', str(lang)]) tasks.manage(*args)
def run_product_tests(): """ runs tests for the features that are activated in the product equation """ features = featuremonkey.get_features_from_equation_file(os.environ['PRODUCT_EQUATION_FILENAME']) args = ['test'] + features tasks.manage(*args)
def run_product_tests(*args): """ Runs tests for the features that are activated in the product equation. Example: $ ape runfeaturetests -r -v=2 """ features = featuremonkey.get_features_from_equation_file(os.environ['PRODUCT_EQUATION_FILENAME']) base_args = ['test'] + features args = base_args + list(args) tasks.manage(*args)
def run_product_tests(*args): """ Runs tests for the features that are activated in the product equation. Example: $ ape runfeaturetests -r -v=2 """ features = featuremonkey.get_features_from_equation_file( os.environ['PRODUCT_EQUATION_FILENAME']) base_args = ['test'] + features args = base_args + list(args) tasks.manage(*args)
def prepare_staticfiles(force=False): """ collect static files for production httpd If run with ``settings.DEBUG==True``, this is a no-op unless ``force`` is set to ``True`` """ #noise reduction: only collectstatic if not in debug mode from django.conf import settings if force or not settings.DEBUG: tasks.manage('collectstatic')
def collectstatic(force=False): """ collect static files for production httpd If run with ``settings.DEBUG==True``, this is a no-op unless ``force`` is set to ``True`` """ #noise reduction: only collectstatic if not in debug mode from django.conf import settings if force or not settings.DEBUG: tasks.manage('collectstatic') print '... finished collectstatic' print else: print '... skipping collectstatic as settings.DEBUG=True; If you want to generate staticfiles anyway, run ape collectstatic instead;'
def collectstatic(force=False): """ collect static files for production httpd If run with ``settings.DEBUG==True``, this is a no-op unless ``force`` is set to ``True`` """ #noise reduction: only collectstatic if not in debug mode from django.conf import settings if force or not settings.DEBUG: tasks.manage('collectstatic', '--noinput') print '... finished collectstatic' print else: print '... skipping collectstatic as settings.DEBUG=True; If you want to generate staticfiles anyway, run ape collectstatic instead;'
def prepare_db(): """ Set up database, e.g. migrate :return: """ tasks.manage("migrate", "--noinput")
def dev(): """ run the development server """ tasks.manage('runserver')
def prepare_db_schema(): """ create the database schema """ tasks.manage('syncdb', '--noinput') tasks.manage('migrate')