How to set Google Credentials to call Google API from Python app on Heroku

前端 未结 1 944
无人及你
无人及你 2021-01-29 01:46

I have created a Python project with Flask and I uploaded it on Heroku as an app. The goal of this app is to identify the brand from a photo of a potato chips produ

相关标签:
1条回答
  • 2021-01-29 02:24

    The solution to my problem was (surprisingly) very simple.

    I had only to replace

    os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "/Users/User/PycharmProjects/Project_brand/Credentials.json"
    

    with

    os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "Credentials.json"
    

    and this works both for my app on Heroku and locally when the Credentials.json file is within the project/app folder.

    0 讨论(0)
提交回复
热议问题