Requests works locally but not deployed on Heroku

纵然是瞬间 提交于 2021-01-29 14:30:14

问题


This code works locally, but when I deploy it to Heroku, I get ModuleNotFoundError: No module named 'requests'. (Note: urllib.parse works fine — news_link prints.)

   import urllib.parse as url_parse
    url = rurl
    news_link = url_parse.unquote(url).split("?u=")[1].split("?fbclid")[0]
    print("here comes the news_link")
    print(news_link)
    import requests
    final_link = requests.get(news_link)
    print("here comes the final_link.url")

回答1:


It looks like you forgot to include requests in the requirements.txt file, check if it is there and in case it is you can try opening the bash console using this answer indications and run a pip freeze to see if it actually is installed or not.



来源:https://stackoverflow.com/questions/61669769/requests-works-locally-but-not-deployed-on-heroku

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!