test_base.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:gitmate-2 作者: GitMateIO 项目源码 文件源码
def reinit_plugin(name, upmate: bool=False):  # pragma: no cover
    """
    Reinitialize gitmate with plugin and upmate, if specified.
    """
    app_name = 'gitmate_' + name
    app_config_name = 'plugins.{}.apps.{}Config'.format(
        app_name, snake_case_to_camel_case(app_name))

    if app_config_name in settings.INSTALLED_APPS:
        return

    settings.GITMATE_PLUGINS += [name]
    settings.INSTALLED_APPS += [app_config_name]
    # To load the new app let's reset app_configs, the dictionary
    # with the configuration of loaded apps
    apps.app_configs = OrderedDict()
    # set ready to false so that populate will work
    apps.ready = False
    # re-initialize them all
    apps.populate(settings.INSTALLED_APPS)

    # migrate the models
    management.call_command('migrate', app_name, interactive=False)

    # upmate the plugins, if specified
    if upmate is True:
        management.call_command('upmate', interactive=False)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号