问题描述
尝试使用call_command从视图运行简单的硒测试。让用户从浏览器中运行预编码的测试。
urls.py
path('',views.button,name='button'),
views.py
def button(request):
if request.GET.get('btn'):
print('Clicked!')
call_command('test')
return render(request,'button.html')
button.html
<form method="get" action="{% url "button" %}">
<input type="submit" class="btn" value="Click" name="btn">
</form>
按钮被点按后,控制台会打印“ Cliked”,但是我收到“ Server Error(500)”。
编辑: 我也收到以下错误:
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)