views.py 文件源码

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

项目:texta 作者: texta-tk 项目源码 文件源码
def add_script_project(request):
    name = request.POST['name']
    desc = request.POST['description']
    entrance = request.POST['entrance']
    arguments = request.POST['arguments']

    sp = ScriptProject(name=name, desc=desc, entrance_point=entrance, arguments=arguments)
    sp.save()

    project_path = os.path.join(SCRIPT_MANAGER_DIR, '%s_%s' % (str(sp.id), canonize_project_name(name)))

    if not os.path.exists(project_path):
        os.makedirs(project_path)

    for file_ in request.FILES.getlist('files[]'):
        path = default_storage.save(os.path.join(project_path, file_.name), ContentFile(file_.read()))

    return HttpResponse()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号