使用Python的Azure计时器触发功能

时间:2018-07-02 18:13:18

标签: python azure azure-functions

我正在使用Python 3.x编写Azure计时器触发器。我已经运行了一个这样的功能。我想我知道这样做,可以从JS创建一个,然后删除“ index.js”并创建run.py。但是这一次,当我运行我的python函数时,总是出现一个错误,提示“没有这样的文件:index.js”。我没有看到函数和'index.js'文件之间有任何联系。

有什么想法吗?

3 个答案:

答案 0 :(得分:3)

尽管我刷新了门户网站,但我仍关注tutorial并发表了我的观点。

enter image description here

但是,等待一段时间后,它会起作用。我怀疑是由于缓存。

enter image description here

我建议您直接在kudu上创建python azure函数。只需在新文件夹中创建run.pyfunction.json即可,而不用更改JS模板。

enter image description here

希望它对您有帮助。

答案 1 :(得分:3)

我们可以直接从Azure门户添加python函数。如果要创建Timetrigger函数,则可以更改触发类型

以下是我创建Python timetrigger函数的详细步骤。

1。Create an Azure function App

2。添加python函数

enter image description here

enter image description here

3。将httptrigger更改为timetrigger

a。删除httptrigger和http输出
enter image description here

b。添加时间触发器 enter image description here

4。添加测试代码并从Azure门户对其进行测试。

enter image description here

默认版本为2.7.8。如果要使用python 3.x,则可以按照此tutorial更新python版本。

5。更新python版本。

  

a。安装Azure功能App的扩展

     

b。添加处理程序映射项,以便通过FastCGI使用Python3.X

enter image description here

6。从Azure门户对其进行测试

enter image description here

答案 2 :(得分:0)

就我而言,在我从门户重新启动 Azure Functions 后,run.py 被识别并运行: Azure Functions > 概述 > 重启

screenshot

相关问题