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))
评论列表
文章目录