[GeoNode-users] Define email service on GeoNode

Jose Cáceres jose.atyus at gmail.com
Thu May 21 16:20:36 PDT 2020


Hi,

Sorry for wasting your time.

I created a new file, secret_codes.py, and I put my credentials in there:



*MY_EMAIL_HOST='smtp.gmail.com
<http://smtp.gmail.com/>'MY_EMAIL_PORT=587MY_EMAIL_HOST_USER='my_mail at gmail.com
<my_mail at gmail.com>'MY_EMAIL_HOST_PASSWORD='my password'*

Then I import secret_codes into settings.py and change the variables like
this:
*    EMAIL_HOST = os.getenv('DJANGO_EMAIL_HOST', *MY_EMAIL_HOST)
*    EMAIL_PORT = os.getenv('DJANGO_EMAIL_PORT', *MY_EMAIL_PORT
*)    EMAIL_HOST_USER = os.getenv('DJANGO_EMAIL_HOST_USER', *
MY_EMAIL_HOST_USER)
*    EMAIL_HOST_PASSWORD = os.getenv('DJANGO_EMAIL_HOST_PASSWORD',*
MY_EMAIL_HOST_PASSWORD*)*

My main concern was to expose the information on my github repository, but
this way I can add the secret_codes to the .gitignore file.

Everything seems to be working fine but I would still like to know if this
is a good way to do it.

Kind regards,

José





[image: Mailtrack]
<https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&>
Remitente
notificado con
Mailtrack
<https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&>
21/05/20
17:18:13

On Thu, May 21, 2020 at 3:38 PM Jose Cáceres <jose.atyus at gmail.com> wrote:

> Hi,
>
> I'm running Geonode on Docker.
>
> I'm having troubles configuring the mail service for Geonode. I was able
> to have it up and running by defining the values directly on my settings.py
> file, like this:
>
>
>
>
>
>
> *EMAIL_ENABLE = ast.literal_eval(os.getenv('EMAIL_ENABLE', 'True'))if
> EMAIL_ENABLE:    EMAIL_BACKEND = os.getenv('DJANGO_EMAIL_BACKEND',
>                     default='django.core.mail.backends.smtp.EmailBackend')
>   EMAIL_HOST = os.getenv('DJANGO_EMAIL_HOST', '*smtp.gmail.com
>
>
>
>
>
>
>
> *')    EMAIL_PORT = os.getenv('DJANGO_EMAIL_PORT', 587)    EMAIL_HOST_USER
> = os.getenv('DJANGO_EMAIL_HOST_USER', 'my_mail at gmail.com
> <my_mail at gmail.com>')    EMAIL_HOST_PASSWORD =
> os.getenv('DJANGO_EMAIL_HOST_PASSWORD', 'mypassword')    EMAIL_USE_TLS =
> ast.literal_eval(os.getenv('DJANGO_EMAIL_USE_TLS', 'True'))
> DEFAULT_FROM_EMAIL = os.getenv('DEFAULT_FROM_EMAIL', 'GeoNode
> <no-reply at geonode.org <no-reply at geonode.org>>')else:    EMAIL_BACKEND =
> os.getenv('DJANGO_EMAIL_BACKEND',
> default='django.core.mail.backends.console.EmailBackend')*
>
> This way I was able to deliver messages to users, send notifications, etc.
>
> But I don't want to have those values available on the settings.py, so I
> figure I could add the variales to my docker-compose file, like this:
>
>
>
>
> *DJANGO_EMAIL_HOST='smtp.gmail.com
> <http://smtp.gmail.com>'DJANGO_EMAIL_PORT=587DJANGO_EMAIL_HOST_USER='my_mail at gmail.com
> <my_mail at gmail.com>'DJANGO_EMAIL_HOST_PASSWORD='my password'*
>
> And I left the values on the settings.py by default:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *EMAIL_ENABLE = ast.literal_eval(os.getenv('EMAIL_ENABLE', 'False'))if
> EMAIL_ENABLE:    EMAIL_BACKEND = os.getenv('DJANGO_EMAIL_BACKEND',
>                     default='django.core.mail.backends.smtp.EmailBackend')
>   EMAIL_HOST = os.getenv('DJANGO_EMAIL_HOST', 'localhost')    EMAIL_PORT =
> os.getenv('DJANGO_EMAIL_PORT', 25)    EMAIL_HOST_USER =
> os.getenv('DJANGO_EMAIL_HOST_USER', '')    EMAIL_HOST_PASSWORD =
> os.getenv('DJANGO_EMAIL_HOST_PASSWORD', '')    EMAIL_USE_TLS =
> ast.literal_eval(os.getenv('DJANGO_EMAIL_USE_TLS', 'False'))
> DEFAULT_FROM_EMAIL = os.getenv('DEFAULT_FROM_EMAIL', 'GeoNode
> <no-reply at geonode.org <no-reply at geonode.org>>')else:    EMAIL_BACKEND =
> os.getenv('DJANGO_EMAIL_BACKEND',
> default='django.core.mail.backends.console.EmailBackend')*
>
> But this way is not working, messages are not sent.
>
> So I want to ask you what is the best way to configure the mail service.
>
> Thanks in advanced.
>
> José
>
>
> --
> José David Cáceres
> Ingeniero Ambiental
> Máster en Tecnologías de la Información Geográfica
> e-mail: jose.atyus at gmail.com
>
>
>
> [image: Mailtrack]
> <https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&> Remitente
> notificado con
> Mailtrack
> <https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&> 21/05/20
> 15:36:45
>


-- 
José David Cáceres
Ingeniero Ambiental
Máster en Tecnologías de la Información Geográfica
e-mail: jose.atyus at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20200521/018114ba/attachment.html>


More information about the geonode-users mailing list