# -*- coding: utf-8 -*-
import os

"""General Django settings file for all websites using the FST webservice

In production, every website has it's own file named 'local_settings.py'.
Use the default values in 'demo_settings.py' as a starting point.
"""

ROOT = os.path.abspath(os.path.dirname(__file__))
path = lambda *args: os.path.join(ROOT, *args)

# Encoding of files read from disk (template and initial SQL files).
FILE_CHARSET = 'utf-8'

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'Europe/Stockholm'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'sv-se'

DATE_FORMAT = 'Y-m-d'

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = True

# Absolute path to the directory that holds media.
# Generate this the same way for all rinfo instances!
MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'uploads')

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'

# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/", "/static/admin/".
ADMIN_MEDIA_PREFIX = '/media/'

# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    #    'django.contrib.staticfiles.finders.DefaultStorageFinder',
    )

# Default. More documentaton here:
# http://docs.djangoproject.com/en/dev/ref/contrib/sites/
SITE_ID = 1

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
    #     'django.template.loaders.eggs.Loader',
    )

TEMPLATE_CONTEXT_PROCESSORS = (
    # Used by default in Django 1.3 (they have to be manually defined when
    # TEMPLATE_CONTEXT_PROCESSORS is overriden like this):
    "django.contrib.auth.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.i18n",
    "django.core.context_processors.media",
    "django.core.context_processors.static",
    "django.contrib.messages.context_processors.messages",
    # Project-specific:
    "fst_web.context_processors.add_request_vars",
    )

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.http.ConditionalGetMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    )

ROOT_URLCONF = 'fst_web.urls'

# Specify one or more directories where templates can be found
TEMPLATE_DIRS = (path('templates'), )

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    #'django.contrib.staticfiles',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    'django.contrib.admindocs',
    # Application specific here
    'fst_web.fs_doc',
    'fst_web.adminplus'
    )

# Ensure that users are logged out automatically if inactive for
# specified time.
SESSION_SAVE_EVERY_REQUEST = True # Refresh cookie on new activity
SESSION_COOKIE_AGE = 30 * 60  # Cookie expires after this number of seconds

# Specify how detailed log output you want
LOG_LEVEL = "WARNING"
DB_DEBUG_LEVEL = "WARNING" # Silence noisy debug output

EMAIL_HOST_USER = None # Email notifications are enabled in local settings

# Check for instance-specific settings
try:
    from local_settings import *
except ImportError:
    from demo_settings import *


@@ -298,16 +298,26 @@
 ile__))%0A
+make_root_
 path = l
@@ -3983,16 +3983,26 @@
 DIRS = (
+make_root_
 path('te

Improve ambigous function name