I get the following error when running the app.
Error running WSGI application 2021-09-13 14:11:59,861: ModuleNotFoundError: No module named 'sendgrid' 2021-09-13 14:11:59,862: File "/var/www/xyz.com_wsgi.py", line 16, in <module> 2021-09-13 14:11:59,862: from app import app as application # noqa 2021-09-13 14:11:59,863: 2021-09-13 14:11:59,864: File "/home/user/appname/app.py", line 12, in <module> 2021-09-13 14:11:59,864: import sendgrid 2021-09-13 14:11:59,865: ******* 2021-09-13 14:11:59,866: If you're seeing an import error and don't know why, 2021-09-13 14:11:59,867: we have a dedicated help page to help you debug: 2021-09-13 14:11:59,867: https://help.pythonanywhere.com/pages/DebuggingImportError/
I have another script in a separate file for the same app that imports sendgrid and have issues with that. Its strange. Also, it works fine, when i run this sendgrid part on python interpreter console.
def send_mail(toMail_, Subject_, body_, cc_):
sg = sendgrid.SendGridAPIClient(api_key=)
data = {
"personalizations": [
{
"to": [
{
"email": toMail_
}
],
"cc": [
{
"email": cc_
}
],
"subject": Subject_
}
],
"from": {
"email": "jithin.john@irishhomes.ie"
},
"content": [
{
"type": "text/plain",
"value": body_
}
]
}
response = sg.client.mail.send.post(request_body=data)
res = response.status_code
return res