Not able to find .env file for OpenAI API key

Hi all!

I have created an app for my research and I need to connect it to OpenAI through an API.

I can run it locally when I define the paths locally. But when I change the path to BASE_FOLDER = "/mount/src/city-app/" which is what I see from os.path.abspath(".env"), it no longer works in deployment.

The issue is that OpenAI cannot find the .env file. I need the API file for the emotion analysis.

Here is the error:


Any help is much appreciated!

Of course it can’t, because there is no .env file in your github repo.
But i assume the .env file contains credentails, therefore better use st.secrets instead.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.