vendredi 8 mai 2015

Django Password Reset shows IP instead of domain name

I am trying to use Django's generic view for resetting password.

from django.contrib.auth.views import password_reset

This is the email template I am using with it:

<p>{% trans "Please go to the following page and choose a new password:" %}<br>
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}
{% endblock %}</p>

Here the {{ domain }} part is not returning my domain name but rather my IP address like http://127.0.0.1:8000/

The subject line also says something like this: Password reset on 127.0.0.1:8000

How do I get the domain name instead of the IP address?

I tried adding

SITE_URL = 'mydomain.com' and SITE_NAME = 'My Website'

to settings.py, but it didn't work.

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire