Письмо отправляется из шаблона email_confirmation_message.txt
{% load account %}{% user_display user as user_display %}{% load i18n %}{% autoescape off %}{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}Hello from {{ site_name }}!
You're receiving this e-mail because user {{ user_display }} has given yours as an e-mail address to connect their account.
To confirm this is correct, go to {{ activate_url }}
{% endblocktrans %}{% endautoescape %}
{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}Thank you from {{ site_name }}!
{{ site_domain }}{% endblocktrans %}
Activ_url отправляет ссылку как http: // web / en / accounts / confirm-email / Mjc: 1fWFRw: q-ScRb0Wnsrrem9N7pB9iLOuPOM /, где web - это мое имя хоста conatiner. Как я могу изменить это имя на собственное доменное имя, не меняя имя хоста conatiner. Я использую django-allauth == 0.33.0






Я думаю, вам не нужно менять свой домен. Он использует ваш собственный домен сайта.
activate_url происходит от get_email_confirmation_url().
activate_url = self.get_email_confirmation_url(
...
def get_email_confirmation_url(self, request, emailconfirmation):
url = reverse(
"account_confirm_email",
args=[emailconfirmation.key])
ret = build_absolute_uri(
request,
url)
return ret
Вы можете увидеть код здесь (код allauth gihtub).
и он использует build_absolute_uri от allatuh.utils.
вот код.
def build_absolute_uri(request, location, protocol=None):
from .account import app_settings as account_settings
if request is None:
site = Site.objects.get_current()
bits = urlsplit(location)
if not (bits.scheme and bits.netloc):
uri = '{proto}://{domain}{url}'.format(
proto=account_settings.DEFAULT_HTTP_PROTOCOL,
domain=site.domain,
url=location)
else:
uri = location
else:
uri = request.build_absolute_uri(location)
# NOTE: We only force a protocol if we are instructed to do so
# (via the `protocol` parameter, or, if the default is set to
# HTTPS. The latter keeps compatibility with the debatable use
# case of running your site under both HTTP and HTTPS, where one
# would want to make sure HTTPS links end up in password reset
# mails even while they were initiated on an HTTP password reset
# form.
if not protocol and account_settings.DEFAULT_HTTP_PROTOCOL == 'https':
protocol = account_settings.DEFAULT_HTTP_PROTOCOL
# (end NOTE)
if protocol:
uri = protocol + ':' + uri.partition(':')[2]
return uri
Вы можете найти этот код здесь
Спасибо @seuling, ваш ответ мне помог. В основном я использовал regex lib для замены имени хоста в строке activate_url.