django 동적 로드 모듈 실례

1241 단어
1 def load_command_class(app_name, name):
2     """
3     Given a command name and an application name, returns the Command
4     class instance. All errors raised by the import process
5     (ImportError, AttributeError) are allowed to propagate.
6     """
7     module = import_module('%s.management.commands.%s' % (app_name, name))
8     return module.Command()

app_name = 'django.contrib.staticfiles
name = 'runserver'

좋은 웹페이지 즐겨찾기