jwjacobson / jazztunes

a jazz repertoire management app
https://jazztunes.org
GNU General Public License v3.0
3 stars 1 forks source link

hook up email provider #193

Closed bbelderbos closed 7 months ago

bbelderbos commented 8 months ago

on heroku you can provision sendgrid, then in settings.py

now: EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"

change to:

if DEBUG:
    EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
else:
    EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"

    # sentry != local = in prod
    import sentry_sdk
    from sentry_sdk.integrations.django import DjangoIntegration

    sentry_sdk.init(
        dsn=os.environ.get("SENTRY_DSN"), integrations=[DjangoIntegration()]
    )

SENDGRID_API_KEY = config("SENDGRID_API_KEY")
  1. only do console backend for email if debug = local
  2. sentry stuff, you have already right -> TODO: set SENTRY_DSN in heroku gui
  3. SENDGRID_API_KEY -> generate this via sendgrid (go in via provisioned app on heroku)
jwjacobson commented 8 months ago

Sendgrid won't let me create an account (perhaps because I don't have a company?) Am looking into alternatives, maybe Mailtrap https://elements.heroku.com/addons/mailtrap

bbelderbos commented 8 months ago

Did you provision it through the heroku gui? Last time that worked for me.

jwjacobson commented 8 months ago

Yes, it was basically instant between provisioning the service and getting the email that my account was denied. I then tried to sign up manually and the same thing happened, now my email address is on file with them. I'm setting up mailtrap now...