0

I have email template: Activate: {{ site }}/accounts/activate/{{ activation_key }}/

I want to set {{site}} to localhost. How can I do this without django-admin panel. I want to use CONSTANT for this.

1 Answers1

0

From the django docs: https://docs.djangoproject.com/en/dev/ref/contrib/sites/

from django.contrib.sites.shortcuts import get_current_site

def my_view(request):
    current_site = get_current_site(request)
    if current_site.domain == 'foo.com':
        # Do something
        pass
    else:
        # Do something else.
        pass

The site information can be passed to your template

joel goldstick
  • 4,393
  • 6
  • 30
  • 46