Running python script in Django from submit

前端 未结 4 520
遥遥无期
遥遥无期 2021-01-30 19:09

Perhaps there is a different way of going about this problem, but I am fairly new to using Django.

I have written a custom python script and would like to run a function

4条回答
  •  余生分开走
    2021-01-30 19:43

    In django 1.11 and python 3.6, I had to use

    return subprocess.run(['python', 'path_to_script//prog17.py', post_from_form], shell=False, timeout=1800)
    

    The rest of @kossta's code worked fine.

提交回复
热议问题