Running python script in Django from submit

前端 未结 4 582
遥遥无期
遥遥无期 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:29

    What @SwankSwashbucklers says is the way to go.

    If you also want to maintain your script separate from the view, you can also use a custom management command and use call_command to call it in the view. This way you can run the script from the command line as well with manage.py mycommand [myargument].

提交回复
热议问题