# Django local_settings for polynum project

# See settings.py for default values

DEBUG = True
#DEBUG = False  # for production
TEMPLATE_DEBUG = DEBUG

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': '/tmp/polynum.sqlite',
    }
}

# production : use PostgreSQL
#DATABASES = {
#    'default': {
#        'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
#        'NAME': 'polynum',                      # Or path to database file if using sqlite3.
#        'USER': 'polynum',                      # Not used with sqlite3.
#        'PASSWORD': 'abcdef',                   # Not used with sqlite3.
#        'HOST': 'db.univ.fr',                   # Set to empty string for localhost. Not used with sqlite3.
#        'PORT': '',                             # Set to empty string for default. Not used with sqlite3.
#    }
#}

# The default site URL
SITE_URL = 'https://polynum.univ.fr'

#
# Upload directory (polynum must have read+write permissions on it)
#
MEDIA_ROOT = '/var/lib/polynum/media/'

#
# Authentification with CAS & LDAP
#
CAS_SERVER_URL = None           # CAS server URL, for ex. 'https://cas.univ.fr/' -- if None, CAS login is disabled
LDAP_URL = 'ldaps://...'        # LDAP server URL
LDAP_BIND_DN = 'uid=...,ou=...' # DN to authenticate to the LDAP server
LDAP_BIND_PASSWORD = '...'      # and its password
LDAP_USER_QUERY = 'supannAliasLogin=%s'  # query to retrieve user, %s is the CAS username
LDAP_BASE = 'dc=univ,dc=fr'     # base DN for the query

# Session duration
# From : https://docs.djangoproject.com/en/1.4/topics/http/sessions/
# You can control whether the session framework uses browser-length sessions
# vs. persistent sessions with the SESSION_EXPIRE_AT_BROWSER_CLOSE setting.
# By default, SESSION_EXPIRE_AT_BROWSER_CLOSE is set to False, which means
# session cookies will be stored in users' browsers for as long as
# SESSION_COOKIE_AGE. Use this if you don't want people to have to log in every
# time they open a browser.
# If SESSION_EXPIRE_AT_BROWSER_CLOSE is set to True, Django will use
# browser-length cookies -- cookies that expire as soon as the user closes his
# or her browser. Use this if you want people to have to log in every time they
# open a browser.

SESSION_EXPIRE_AT_BROWSER_CLOSE = True
SESSION_COOKIE_AGE = 24*3600  # 1 day, only if SESSION_EXPIRE_AT_BROWSER_CLOSE = False

#
# Design
#
# static files -- must be created with "polynum-manage.py collectstatic"
STATIC_ROOT = '/opt/polynum/static'
# Additional locations of static files (to override default 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.
)
# grappelli admin -- see http://readthedocs.org/docs/django-grappelli
GRAPPELLI_ADMIN_TITLE = 'Administration de PolyNum'
# templates
TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    '/opt/polynum/local/templates',
    '/opt/polynum/polynum/templates',
)

#
# OAI METADATA for OAI-PMH exports
# 
OAI_ADMIN_EMAIL = 'admin@univ.fr'
OAI_TEXT = 'Polynum documents'
OAI_REPOSITORY_NAME = 'Polynum OAI-PMH repository'
