<div dir="ltr"><div dir="ltr">Hi,<div><br></div><div>Sorry for wasting your time.</div><div><br></div><div>I created a new file, secret_codes.py, and I put my credentials in there:</div><div><i>MY_EMAIL_HOST='<a href="http://smtp.gmail.com/" target="_blank">smtp.gmail.com</a>'<br>MY_EMAIL_PORT=587<br>MY_EMAIL_HOST_USER='<a href="mailto:my_mail@gmail.com" target="_blank">my_mail@gmail.com</a>'<br>MY_EMAIL_HOST_PASSWORD='my password'</i>  </div><div><br></div><div>Then I import secret_codes into settings.py and change the variables like this:</div><div><i>    EMAIL_HOST = os.getenv('DJANGO_EMAIL_HOST', </i>MY_EMAIL_HOST)  <i><br>    EMAIL_PORT = os.getenv('DJANGO_EMAIL_PORT', </i>MY_EMAIL_PORT<i>)<br>    EMAIL_HOST_USER = os.getenv('DJANGO_EMAIL_HOST_USER', </i>MY_EMAIL_HOST_USER)  <i><br>    EMAIL_HOST_PASSWORD = os.getenv('DJANGO_EMAIL_HOST_PASSWORD',</i>

MY_EMAIL_HOST_PASSWORD<i>)</i> <br></div><div><br></div><div>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.</div><div><br></div><div>Everything seems to be working fine but I would still like to know if this is a good way to do it.</div><div><br></div><div>Kind regards,</div><div><br></div><div>José</div><div><br><br><br><br></div><br><div id="mt-signature">
        <table border="0" cellpadding="8" cellspacing="0" style="user-select: none;">
            <tbody><tr>
                <td>
                    <a href="https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&" class="" style="text-decoration:none">
                        <img src="https://s3.amazonaws.com/mailtrack-signature/sender_notified.gif" alt="Mailtrack" class="" width="32" height="32">
                    </a>
                </td>
                <td>
                    <span style="color:#777">Remitente notificado con</span> <br>
                    <a href="https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&" class="mt-install" style="color:#4374f7">Mailtrack</a>
                    <span style="color:transparent;font-size:0">21/05/20 17:18:13</span>
                </td>
                <td>
                    
                </td>
            </tr>
        </tbody></table>
    </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 21, 2020 at 3:38 PM Jose Cáceres <<a href="mailto:jose.atyus@gmail.com">jose.atyus@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I'm running Geonode on Docker.<br><div><br></div><div>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:</div><div><br></div><div><i>EMAIL_ENABLE = ast.literal_eval(os.getenv('EMAIL_ENABLE', 'True'))<br><br>if EMAIL_ENABLE:<br>    EMAIL_BACKEND = os.getenv('DJANGO_EMAIL_BACKEND',<br>                              default='django.core.mail.backends.smtp.EmailBackend')<br>    EMAIL_HOST = os.getenv('DJANGO_EMAIL_HOST', '</i><a href="http://smtp.gmail.com" target="_blank">smtp.gmail.com</a><i>')<br>    EMAIL_PORT = os.getenv('DJANGO_EMAIL_PORT', 587)<br>    EMAIL_HOST_USER = os.getenv('DJANGO_EMAIL_HOST_USER', '<a href="mailto:my_mail@gmail.com" target="_blank">my_mail@gmail.com</a>')<br>    EMAIL_HOST_PASSWORD = os.getenv('DJANGO_EMAIL_HOST_PASSWORD', 'mypassword')<br>    EMAIL_USE_TLS = ast.literal_eval(os.getenv('DJANGO_EMAIL_USE_TLS', 'True'))<br>    DEFAULT_FROM_EMAIL = os.getenv('DEFAULT_FROM_EMAIL', 'GeoNode <<a href="mailto:no-reply@geonode.org" target="_blank">no-reply@geonode.org</a>>')<br>else:<br>    EMAIL_BACKEND = os.getenv('DJANGO_EMAIL_BACKEND',<br>                              default='django.core.mail.backends.console.EmailBackend')</i><br></div><div><br></div><div>This way I was able to deliver messages to users, send notifications, etc.</div><div><br></div><div>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:</div><div><br></div><div><i>DJANGO_EMAIL_HOST='<a href="http://smtp.gmail.com" target="_blank">smtp.gmail.com</a>'<br>DJANGO_EMAIL_PORT=587<br>DJANGO_EMAIL_HOST_USER='<a href="mailto:my_mail@gmail.com" target="_blank">my_mail@gmail.com</a>'<br>DJANGO_EMAIL_HOST_PASSWORD='my password'</i><br><div><div><br></div><div>And I left the values on the settings.py by default:</div><div><br></div><div><i>EMAIL_ENABLE = ast.literal_eval(os.getenv('EMAIL_ENABLE', 'False'))<br><br>if EMAIL_ENABLE:<br>    EMAIL_BACKEND = os.getenv('DJANGO_EMAIL_BACKEND',<br>                              default='django.core.mail.backends.smtp.EmailBackend')<br>    EMAIL_HOST = os.getenv('DJANGO_EMAIL_HOST', 'localhost')<br>    EMAIL_PORT = os.getenv('DJANGO_EMAIL_PORT', 25)<br>    EMAIL_HOST_USER = os.getenv('DJANGO_EMAIL_HOST_USER', '')<br>    EMAIL_HOST_PASSWORD = os.getenv('DJANGO_EMAIL_HOST_PASSWORD', '')<br>    EMAIL_USE_TLS = ast.literal_eval(os.getenv('DJANGO_EMAIL_USE_TLS', 'False'))<br>    DEFAULT_FROM_EMAIL = os.getenv('DEFAULT_FROM_EMAIL', 'GeoNode <<a href="mailto:no-reply@geonode.org" target="_blank">no-reply@geonode.org</a>>')<br>else:<br>    EMAIL_BACKEND = os.getenv('DJANGO_EMAIL_BACKEND',<br>                              default='django.core.mail.backends.console.EmailBackend')</i><br></div><div><br></div><div>But this way is not working, messages are not sent.</div><div><br></div><div>So I want to ask you what is the best way to configure the mail service.</div><div><br></div><div>Thanks in advanced.</div><div><br></div><div>José</div><div><br></div><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div>José David Cáceres<div>Ingeniero Ambiental</div><div>Máster en Tecnologías de la Información Geográfica<br><div>e-mail: <a href="mailto:jose.atyus@gmail.com" target="_blank">jose.atyus@gmail.com</a></div></div></div></div></div><br></div></div><br></div><br><div id="gmail-m_-297718752991462819mt-signature">
        <table border="0" cellpadding="8" cellspacing="0">
            <tbody><tr>
                <td>
                    <a href="https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&" style="text-decoration:none" target="_blank">
                        <img src="https://s3.amazonaws.com/mailtrack-signature/sender_notified.gif" alt="Mailtrack" width="32" height="32">
                    </a>
                </td>
                <td>
                    <span style="color:rgb(119,119,119)">Remitente notificado con</span> <br>
                    <a href="https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&" style="color:rgb(67,116,247)" target="_blank">Mailtrack</a>
                    <span style="color:transparent;font-size:0px">21/05/20 15:36:45</span>
                </td>
                <td>
                    
                </td>
            </tr>
        </tbody></table>
    </div><img width="0" height="0" alt="" style="display: flex;"></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>José David Cáceres<div>Ingeniero Ambiental</div><div>Máster en Tecnologías de la Información Geográfica<br><div>e-mail: <a href="mailto:jose.atyus@gmail.com" target="_blank">jose.atyus@gmail.com</a></div></div></div></div></div><img width="0" height="0" class="mailtrack-img" alt="" style="display:flex" src="https://mailtrack.io/trace/mail/7a790771e7aafaebe0aa2f39790185e073e5f8d2.png?u=16998"></div>