【问题标题】:Requests works locally but not deployed on Heroku请求在本地工作,但未部署在 Heroku 上
【发布时间】:2020-08-23 10:57:10
【问题描述】:

此代码在本地工作,但是当我将其部署到 Heroku 时,我得到 ModuleNotFoundError: No module named 'requests'。 (注意:urllib.parse 工作正常 - news_link 打印。)

   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")

【问题讨论】:

    标签: python url heroku


    【解决方案1】:

    您似乎忘记在 requirements.txt 文件中包含请求,检查它是否存在,如果存在,您可以尝试使用 this answer indications 打开 bash 控制台并运行 pip freeze 以查看它是否真的存在安装与否。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-12-20
      • 1970-01-01
      • 2023-01-11
      • 2014-05-27
      • 2016-01-20
      • 2023-03-17
      • 2020-10-19
      相关资源
      最近更新 更多