longclaw.py 文件源码

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

项目:longclaw 作者: JamesRamm 项目源码 文件源码
def create_project(args):
    """
    Create a new django project using the longclaw template
    """

    # Make sure given name is not already in use by another python package/module.
    try:
        __import__(args.project_name)
    except ImportError:
        pass
    else:
        sys.exit("'{}' conflicts with the name of an existing "
                 "Python module and cannot be used as a project "
                 "name. Please try another name.".format(args.project_name))

    # Get the longclaw template path
    template_path = path.join(path.dirname(longclaw.__file__), 'project_template')

    utility = ManagementUtility((
        'django-admin.py',
        'startproject',
        '--template={}'.format(template_path),
        '--ext=html,css,js,py,txt',
        args.project_name
    ))
    utility.execute()
    print("{} has been created.".format(args.project_name))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号