settings.py 文件源码

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

项目:vpn-porthole 作者: sourcesimian 项目源码 文件源码
def __ensure_config_setup(cls):
        root = cls.__default_settings_root()
        if not os.path.exists(root):
            os.makedirs(root)

        settings_file = os.path.join(root, 'settings.conf')
        if not os.path.exists(settings_file):
            with open(settings_file, 'w+b') as fh:
                content = resource_stream("vpnporthole", "resources/settings.conf").read()
                fh.write(content)
            print("* Wrote: %s" % settings_file)

        root = os.path.join(root, 'profiles')
        if not os.path.exists(root):
            os.makedirs(root)

            profile_file = os.path.join(root, 'example.conf')
            if not os.path.exists(profile_file):
                with open(profile_file, 'w+b') as fh:
                    content = resource_stream("vpnporthole", "resources/example.conf").read()
                    fh.write(content)
                print("* Wrote: %s" % profile_file)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号