Forums

Getting 500 Internal Server Error even when I have setup the .env file correctly

Hey there,

As I noted in my Topic title, I've uploaded my Flask-App project files where the trigger file is main.py and also added the .env file correctly.

But still when I run the initial form page thro' python main.py command and fill out comma separated emails and upload any picture and hit Send File button, it throws below error:

File "/home/<Username>/mysite/main.py", line 25, in success
    send_email(savePath, request.form['email'], dotenv_values('.env')['SMTP_FROM_EMAIL'], subject, bodyHtml)
KeyError: 'SMTP_FROM_EMAIL'

Let me tell you, this code is running perfect in Local Host port 5000 on my local machine

What code are you using to load up the .env file?