我想知道在呈现Django页面后是否有执行命令的方法
我有一个系统,我将电话培训变量设置为False,并使用subprocess.Popen运行命令行,我必须等待命令以.communicate()结束,然后说电话培训变量为True,但执行该命令大约需要15分钟,因此,我希望在执行命令后立即呈现页面。我的代码如下:
def GerarTreinoTelefonia(request):
global treinamentotelefonia
if treinamentotelefonia == False:
if request.method == 'POST':
treinamentotelefonia = True
treinotelefonia = subprocess.Popen(shlex.split('python -m rasa_nlu.train -c chatbot/config/config_nlu.yml --data chatbot/dados/ilhas/telefonia/ -o /code/chatbot/models/telefonia --fixed_model_name nlu --project current --verbose'))
return render(request, 'website/PainelGerenciamento.html')
treinotelefonia.communicate()
treinamentotelefonia = False
你知道我怎么做吗
目前没有回答
相关问题 更多 >
编程相关推荐