gpt4 book ai didi

azure - 如何编辑只读 Azure Function python 代码

转载 作者:行者123 更新时间:2023-12-02 06:00:46 25 4
gpt4 key购买 nike

我正在尝试向之前上传的 Azure Functions 添加修复程序,但似乎无济于事。

这是我到目前为止所做的:

  • 尝试通过浏览器内编辑器进行更改时,页面顶部会弹出一个横幅:
    该函数已通过外部编辑器进行编辑。门户编辑已禁用。
    毫不奇怪,尝试在内部输入时会显示 无法在只读编辑器中编辑 消息。

  • 接下来,我按照 this tutorial 安装了 Visual Studio Code 的 Azure Functions 扩展。 。登录后,打开解决方案,仍然是只读,无法编辑。

  • 然后我找到了this StackOverflow post展示如何下载 Function 应用内容、进行更改并重新上传。不幸的是,下载应用程序内容的按钮是 greyed out in the portal ,所以我无法下载应用程序文件。

  • 我尝试通过添加 FUNCTION_APP_EDIT_MODE tag and setting it to 'readwrite' 来更改 Function 应用程序配置 json ,没有成功。

  • 我也尝试过通过 Azure 门户直接上传固定文件,却收到错误消息,说它只支持上传最大 5MB,尽管固定文件只有 13KB。

有人有处理此类问题的经验吗?任何见解或指示将不胜感激。

谢谢

最佳答案

当您在Azure门户中创建Python函数应用程序时,“下载应用程序内容”选项将被禁用: enter image description here将项目从 VS Code 发布到 Azure Function App 后: enter image description here

发生这种情况是因为 Azure Python Functions 禁用了门户内编辑。引用这个GitHub Announcement了解更多信息。

<小时/>

编辑/更新 Azure Python Functions 代码的解决方法之一是:

  1. 创建一个新项目并从 Azure 门户 > Function App > App Files 复制这些文件:
    • host.json 文件
    • requirements.txt 文件

enter image description here

  • 从 Azure 门户 > 您的函数应用 > 函数 > 函数的代码+测试菜单 >
    • init.py文件
    • function.json 文件
  • enter image description here

    复制这些文件的代码并将其粘贴到您的新项目中。

    或者,您可以在 VS Code 中编辑已发布的项目(如果有)并发布更改。

    <小时/>

    另一个解决方法是使用 GitHub 源设置持续部署,这样您的项目代码就可以在 GitHub 中找到,您可以通过编辑选项来修改 GitHub 中的代码并将更改推送到 Azure

    enter image description here

    引用Azure Functions Configure Continuous deployment了解更多信息。

    <小时/>

    关于azure - 如何编辑只读 Azure Function python 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72410177/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com