def main(): os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'localshop.settings') os.environ.setdefault('DJANGO_CONFIGURATION', 'Localshop') from configurations.management import execute_from_command_line execute_from_command_line(sys.argv)
def main(): os.environ.setdefault("DJANGO_SETTINGS_MODULE", "beehve.settings") os.environ.setdefault("DJANGO_CONFIGURATION", "Dev") from configurations.management import execute_from_command_line execute_from_command_line(sys.argv)
def cratis_cmd(): """ Command that executes django ./manage.py task + adds cratis wrapping things """ os.environ.setdefault("CRATIS_APP_PATH", os.getcwd()) os.environ.setdefault('DJANGO_CONFIGURATION', 'Dev') load_env() from configurations.management import execute_from_command_line execute_from_command_line(sys.argv)
def handle(self, *args, **options): if len(args) == 0: _args = ["manage.py", "test", "users", "concepts", "orgs", "oclapi", "sources", "collection", "mappings"] else: _args = ["manage.py", "test"] for item in args: print("Appending argument: {0}".format(item)) _args.append(item) if options["failfast"]: _args.append("--failfast") execute_from_command_line(_args)
def run(self): if self.distribution.install_requires: self.distribution.fetch_build_eggs( self.distribution.install_requires) if self.distribution.tests_require: self.distribution.fetch_build_eggs(self.distribution.tests_require) for env_name, env_value in self.extra_env.items(): os.environ[env_name] = str(env_value) this_dir = os.getcwd() testproj_dir = os.path.join(this_dir, 'localshop') os.chdir(testproj_dir) sys.path.append(testproj_dir) os.environ['DJANGO_SETTINGS_MODULE'] = os.environ.get( 'DJANGO_SETTINGS_MODULE', 'localshop.settings') os.environ['DJANGO_CONFIGURATION'] = os.environ.get( 'DJANGO_CONFIGURATION', 'Localshop') from configurations.management import execute_from_command_line execute_from_command_line([__file__, 'test'])
#!/usr/bin/env python import os import sys import dotenv if __name__ == '__main__': # Load a .env file dotenv.load_dotenv(dotenv.find_dotenv()) # Set up configuration modules os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings') configuration_name = os.getenv('ENVIRONMENT', 'Development') os.environ.setdefault('DJANGO_CONFIGURATION', configuration_name) # Call the Django command from configurations.management import execute_from_command_line execute_from_command_line(sys.argv)
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault('DJANGO_SETTINGS_MODULE', '{{ project_name }}.settings') os.environ.setdefault('DJANGO_CONFIGURATION', 'Dev') from configurations.management import execute_from_command_line execute_from_command_line(sys.argv)
def run(): from configurations.management import execute_from_command_line execute_from_command_line(sys.argv)
def main(): os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'coursera_webpack.settings') os.environ.setdefault('DJANGO_CONFIGURATION', 'Dev') from configurations.management import execute_from_command_line execute_from_command_line(sys.argv)
def main(): os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings') os.environ.setdefault('DJANGO_CONFIGURATION', 'Test') from configurations.management import execute_from_command_line execute_from_command_line(sys.argv)
# -*- coding: utf-8 -*- import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings") os.environ['DJANGO_CONFIGURATION'] = "Testing" from configurations.management import execute_from_command_line args = ['manage.py', 'test'] + sys.argv[1:] execute_from_command_line(args)