阅读背景:

什么是Azure CloudService上的python的RoleEnvironment.GetLocalResource?

来源:互联网 

I'm running a python website, and want to use the LocalStorage on the WebRole of Azure CloudService.

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

And I can't get the path of the storage but using RoleEnvironment.GetLocalResource(name_of_storage) in C#.

我无法获得存储路径,但在C#中使用RoleEnvironment.GetLocalResource(name_of_storage)。

So what is the equivalent version of RoleEnvironment.GetLocalResource in Python?

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

1 个解决方案

#1


0  

I've dealt with the problem with a simple environment variables "proxy" written by C#.

我用C#编写的简单环境变量“proxy”处理了这个问题。

Thanks to this 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);
        }

It load the LocalResource configuration, then copy them to system environment variable.

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

It works for me.

这个对我有用。


分享到: