什么是`RoleEnvironment.GetLocalResource`Azure CloudService上的python等价物?

2024-09-20 22:54:53 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在运行一个python网站,并希望在azurecloudservice的WebRole上使用LocalStorage。在

我无法得到存储的路径,只能使用C中的RoleEnvironment.GetLocalResource(name_of_storage)。在

那么在Python中RoleEnvironment.GetLocalResource的等效版本是什么呢?在


Tags: ofname路径版本网站servicestoragelocalstorage
1条回答
网友
1楼 · 发布于 2024-09-20 22:54:53

我已经用一个简单的环境变量“proxy”来处理这个问题。在

多亏了这个article。在

    static void Main(string[] args)
    {
        foreach (var arg in args)
        {
            var path = RoleEnvironment.GetLocalResource(arg).RootPath;
            Console.WriteLine($"LocalRes_{arg}: {path}");
            Environment.SetEnvironmentVariable($"LocalRes_{arg}", path, EnvironmentVariableTarget.Machine);
        }

它加载LocalResource配置,然后将它们复制到系统环境变量中。在

对我有用。在

相关问题 更多 >

    热门问题