[英]Module import Error and NameError in Flask using Heroku
將小型應用程序部署到heroku時確實存在此問題,requirements.txt非常小,使用時Cannot import module 'NewsApiClient'
導致應用程序崩潰
from newsapi import NewsApiClient
並且當from newsapi import *
使用時,該應用實際上以500內部錯誤from newsapi import *
NameError:未定義名稱“ NewsApiClient”
newsapi = NewsApiClient(api_key='xxxxxxxxxx')
到目前為止,我所做的是在根文件夾上創建一個空的初始化文件
看來您在您的requirements.txt
文件中導入了錯誤的程序包。 您導入的newsapi軟件包與python-newsapi軟件包不同。
只要重新安裝軟件包依賴項,將newsapi==0.1.1
更改為newsapi-python==0.2.3
解決導入錯誤的問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.