# Path: staticgen/helpers.py
# def get_static_site_domain():
#     static_site_domain = settings.STATICGEN_STATIC_SITE_DOMAIN
#     if static_site_domain is None:
#         connection = connect_s3(
#             settings.AWS_ACCESS_KEY_ID,
#             settings.AWS_SECRET_ACCESS_KEY
#         )
#         bucket = connection.get_bucket(settings.AWS_STORAGE_BUCKET_NAME)
#         static_site_domain = bucket.get_website_endpoint()
#     return static_site_domain.rstrip('/')


from django.contrib.sites.models import Site
from .helpers import get_static_site_domain
# -*- coding: utf-8 -*-

from __future__ import unicode_literals




def staticgen_publisher(request):
    context = {}

    is_publishing = request.META.get('HTTP_X_STATICGEN_PUBLISHER', False)
    context['STATICGEN_IS_PUBLISHING'] = is_publishing

    current_site = Site.objects.get_current()

    base_url = current_site.domain

# Path: staticgen/helpers.py
# def get_static_site_domain():
#     static_site_domain = settings.STATICGEN_STATIC_SITE_DOMAIN
#     if static_site_domain is None:
#         connection = connect_s3(
#             settings.AWS_ACCESS_KEY_ID,
#             settings.AWS_SECRET_ACCESS_KEY
#         )
#         bucket = connection.get_bucket(settings.AWS_STORAGE_BUCKET_NAME)
#         static_site_domain = bucket.get_website_endpoint()
#     return static_site_domain.rstrip('/')


# Path: staticgen/context_processors.py
from django.contrib.sites.models import Site
from .helpers import get_static_site_domain

# -*- coding: utf-8 -*-

from __future__ import unicode_literals




def staticgen_publisher(request):
    context = {}

    is_publishing = request.META.get('HTTP_X_STATICGEN_PUBLISHER', False)
    context['STATICGEN_IS_PUBLISHING'] = is_publishing

    current_site = Site.objects.get_current()

    base_url = current_site.domain

    if is_publishing: