2017-08-16 63 views

回答

0

與Plot.ly的問題是,它需要的憑據進行安裝:

import plotly 
plotly.tools.set_credentials_file(username='SomeDemoAccount', api_key='SomeAPIKey') 

而這將不作爲代碼在控制檯,因爲實例不運行,而不是從SSH可以訪問~/.plotly/.credentials文件,即它不能創建或訪問它,所以任何對API的調用都將失敗。在AWS日誌,你會得到以下錯誤:

Looks like you don't have 'read-write' permission to your 'home' ('~') directory or to our '~/.plotly' directory. That means plotly's python api can't setup local configuration files. No problem though! You'll just have to sign-in using 'plotly.plotly.sign_in()'. For help with that: 'help(plotly.plotly.sign_in)'. 

所以解決的辦法就是調用它甚至沒有自己的入門指南,也不是API參考中提到的plotly.plotly.sign_in()方法,並且必須與以下參數調用:

plotly.plotly.sign_in("Your Plotly Username","Your Plotly API Key") 

那我實現了具有這些值作爲EB環境屬性:

plotly.plotly.sign_in(os.environ['YOUR_PLOTLY_USERNAME_ENV_PROPERTY_NAME'],os.environ['YOUR_PLOTLY_API_KEY_ENV_PROPERTY_NAME']) 
相關問題