# Path: staticsites/utilities.py
# def get_deploy_root(deploy_root=None, app=None, deploy_type=None, path=None):
#     """
#     Return the correct deploy_root from configuration or input value
#     :param deploy_root: The deploy root
#     :param app: The current deploying app
#     :param deploy_type: The deploy type
#     :param path: The current destination path
#     :return: The correct deploy_root
#     """
#     deploy_root = get_conf('STATICSITE_DEPLOY_ROOT', app=app, deploy_type=deploy_type, path=path, input=deploy_root)
#     deploy_root_date_format = get_deploy_root_date_format(None, app, deploy_type, path)
#     deploy_root = deploy_root % {
#         'deploy_type': deploy_type,
#         'asctime': datetime.now().strftime(deploy_root_date_format)
#     }
# 
#     return deploy_root
# 
# def get_default_index(app=None, deploy_type=None):
#     """
#     Return the correct default_index from configuration or input value
#     :param app: The current deploying app
#     :param deploy_type: The deploy type
#     :return: The correct default_index
#     """
#     return get_conf('STATICSITE_DEFAULT_INDEX', app=app, deploy_type=deploy_type)


from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.static import serve
from staticsites.utilities import get_deploy_root, get_default_index

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'staticsites_project2.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),

    url(r'^admin/', include(admin.site.urls)),
)

# Serve default deploy folder as site root
if settings.DEBUG:
    urlpatterns += [
        url(
            r'^(?:%s)?$' % get_default_index(deploy_type='dev'),
            serve,
            {

# Path: staticsites/utilities.py
# def get_deploy_root(deploy_root=None, app=None, deploy_type=None, path=None):
#     """
#     Return the correct deploy_root from configuration or input value
#     :param deploy_root: The deploy root
#     :param app: The current deploying app
#     :param deploy_type: The deploy type
#     :param path: The current destination path
#     :return: The correct deploy_root
#     """
#     deploy_root = get_conf('STATICSITE_DEPLOY_ROOT', app=app, deploy_type=deploy_type, path=path, input=deploy_root)
#     deploy_root_date_format = get_deploy_root_date_format(None, app, deploy_type, path)
#     deploy_root = deploy_root % {
#         'deploy_type': deploy_type,
#         'asctime': datetime.now().strftime(deploy_root_date_format)
#     }
# 
#     return deploy_root
# 
# def get_default_index(app=None, deploy_type=None):
#     """
#     Return the correct default_index from configuration or input value
#     :param app: The current deploying app
#     :param deploy_type: The deploy type
#     :return: The correct default_index
#     """
#     return get_conf('STATICSITE_DEFAULT_INDEX', app=app, deploy_type=deploy_type)


# Path: staticsites/tests/urls.py
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.static import serve
from staticsites.utilities import get_deploy_root, get_default_index


urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'staticsites_project2.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),

    url(r'^admin/', include(admin.site.urls)),
)

# Serve default deploy folder as site root
if settings.DEBUG:
    urlpatterns += [
        url(
            r'^(?:%s)?$' % get_default_index(deploy_type='dev'),
            serve,
            {

                'document_root': get_deploy_root(deploy_type='dev'), 'path': get_default_index(deploy_type='dev')