from django.contrib.sites.shortcuts import get_current_site
from urlparse import urljoin
def site_url(request):
    scheme = 'https' if request.is_secure() else 'http'
    site = get_current_site(request)
    #domain = "{}://{}".format(scheme, site.domain)

    return {
        'site_url':  "{}://{}".format(scheme, site.domain),
        'site_name': site.name
    }
from django.contrib.sites.shortcuts import get_current_site

def site_url(request):
    scheme = 'https' if request.is_secure() else 'http'
    site = get_current_site(request)
    #domain = "{}://{}".format(scheme, site.domain)

    return {
        'site_url':  "{}://{}".format(scheme, site.domain),
        'site_name': site.name
    }
Remove urlparse import as not used and also renamed in Python 3 to urllib.parse
Remove urlparse import as not used and also renamed in Python 3 to urllib.parse

  from django.contrib.sites.shortcuts import get_current_site
- from urlparse import urljoin
+ 
  def site_url(request):
      scheme = 'https' if request.is_secure() else 'http'
      site = get_current_site(request)
      #domain = "{}://{}".format(scheme, site.domain)
  
      return {
          'site_url':  "{}://{}".format(scheme, site.domain),
          'site_name': site.name
      }
Remove urlparse import as not used and also renamed in Python 3 to urllib.parse
## Code Before:
from django.contrib.sites.shortcuts import get_current_site
from urlparse import urljoin
def site_url(request):
    scheme = 'https' if request.is_secure() else 'http'
    site = get_current_site(request)
    #domain = "{}://{}".format(scheme, site.domain)

    return {
        'site_url':  "{}://{}".format(scheme, site.domain),
        'site_name': site.name
    }
## Instruction:
Remove urlparse import as not used and also renamed in Python 3 to urllib.parse
## Code After:
from django.contrib.sites.shortcuts import get_current_site

def site_url(request):
    scheme = 'https' if request.is_secure() else 'http'
    site = get_current_site(request)
    #domain = "{}://{}".format(scheme, site.domain)

    return {
        'site_url':  "{}://{}".format(scheme, site.domain),
        'site_name': site.name
    }