Running an exe file on the azure

时间:2016-07-11 19:40:30

标签: python django azure azure-devops

I am working on an azure web app and inside the web app, I use python code to run an exe file. The webapp recieves certain inputs (numbers) from the user and stores those inputs in in a text file. Afterwards, an exe file would run and read the inputs and generate another text file, called "results". The problem is that although the code works fine on my local computer, as soos as I put it on azure, the exe file does not get triggered by the following line of code:

subprocess.call('process.exe',cwd = case_directory.path, shell= True)

I even tried running the exe file on Azure manually from the Visual Studio Team Services (was Visual Studio Online) by "running from Console" option. It just did not do anything. I'd appreciate if anyone can help me.

2 个答案:

答案 0 :(得分:0)

您是否考虑过使用WebJob来托管\运行您的可执行文件? WebJob几乎可以是任何类型的脚本或win可执行文件。有许多方法可以触发您的WebJob。您还可以通过Kudu界面免费获得免费监控和日志记录。

答案 1 :(得分:0)

@ F.K我搜索了一些可能对您有所帮助的信息,请参阅下文。

  1. 正在编写subprocess模块的python文档,Using shell=True can be a security hazard.有关详细信息,请参阅Frequently Used Arguments下的警告。
  2. article中有评论为此问题指明了方向,请参阅下面的屏幕截图。
  3. enter image description here

    但是,通常情况下,推荐的满足您需求的方法是使用Azure Queue& Blob存储& Azure WebJobs将输入文件保存到存储队列中,并处理从队列中获取的文件,并通过连续的webjob将结果文件保存到blob存储中。