【发布时间】:2016-12-08 11:04:03
【问题描述】:
我的views.py 中编写了一个发送子进程命令的方法。
我希望能够单击我的 Django 应用程序上的一个按钮,它会启动我编写的方法。
我该怎么做?
这是我在views.py中的当前函数
def send_command(request):
output = subprocess.check_output('ls', shell=True)
print(output)
return render(request, 'button.html')
我在 .html 文件中也有一个按钮
<center><button type='submit' class='btn btn-lg'>Button</button></center>
我对此非常陌生,因此我们将不胜感激。请随时询问更多信息。
【问题讨论】:
-
@Taylor 我相信你链接的问题与 Tkinter 而不是 Django/html 相关
-
this 可能会有所帮助
-
@an0o0nym 太好了,我去看看!谢谢
标签: python html django methods views