From e45296a593eef92a861fa086b2967ead48ad999f Mon Sep 17 00:00:00 2001 From: Thomas NOEL Date: Thu, 19 Jul 2012 12:49:20 +0200 Subject: [PATCH] config et scripts un peu plus compatibles FHS codes dans /opt/polynum config dans /etc/opt/polynum donnees dans /var/opt/polynum --- Makefile | 6 +++-- bin/polynum-manage.py | 2 +- help/fr/install.page | 13 ++++++----- local_settings.py.example | 47 +++++++++++++++++++++++---------------- 4 files changed, 40 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index af5db20..c0bf5e6 100644 --- a/Makefile +++ b/Makefile @@ -15,14 +15,16 @@ rebuild-indexes: python manage.py sqlindexes base | sed 's/CREATE/DROP/;s/INDEX/INDEX IF EXISTS/;s/ ON.*;/;/' | psql polynum python manage.py sqlindexes base | psql polynum -# only for package creation + +# mainly for packages creation INSTALL=/usr/bin/install CP=/bin/cp install: $(INSTALL) -d $(DESTDIR)/opt/polynum $(CP) -r polynum $(DESTDIR)/opt/polynum $(CP) -r bin $(DESTDIR)/opt/polynum - $(INSTALL) -d $(DESTDIR)/etc/polynum + $(INSTALL) -d $(DESTDIR)/etc/opt/polynum + $(INSTALL) -d $(DESTDIR)/var/opt/polynum deb: dch --newversion=0.0.`date +%Y%m%d`~git`git log -1 --oneline | cut -f1 -d" "`-1 diff --git a/bin/polynum-manage.py b/bin/polynum-manage.py index dfdf0c1..be81c95 100755 --- a/bin/polynum-manage.py +++ b/bin/polynum-manage.py @@ -11,7 +11,7 @@ if not os.path.isdir(POLYNUM_DIR): sys.exit(1) sys.path.append(POLYNUM_DIR) -sys.path.append('/etc/polynum') +sys.path.append('/etc/opt/polynum') # for "import local_settings" if os.path.isdir(VIRTUAL_ENV): site_packages = os.path.join(VIRTUAL_ENV, diff --git a/help/fr/install.page b/help/fr/install.page index 003d9e5..5370e12 100644 --- a/help/fr/install.page +++ b/help/fr/install.page @@ -35,7 +35,8 @@ Dans la suite, l'arborescence des fichiers est la suivante :

/opt/polynum/polynum

code de l'application Django Polynum

/opt/polynum/bin

scripts associés au projet

/opt/polynum/virtualenv

environnement virtuel Python (voir plus loin)

-

/etc/polynum

répertoire de configuration

+

/etc/opt/polynum

répertoire de configuration

+

/var/opt/polynum

répertoire des données (fichiers PDF)

@@ -151,18 +152,18 @@ pour s'exécuter.
Configuration de base l'application -

La configuration de l'application se fait dans /etc/polynum/local_settings.py

+

La configuration de l'application se fait dans /etc/opt/polynum/local_settings.py

Un fichier d'exemple local_settings.py.example est fourni avec Polynum, c'est un modèle pour la création de -/etc/polynum/local_settings.py : il contient la liste des +/etc/opt/polynum/local_settings.py : il contient la liste des paramétrages possibles avec explications et exemples.

Si vous avez installé Polynum à partir du paquet, le modèle est placé dans /usr/share/doc/polynum/, il vous suffit donc de faire :

-# cd /etc/polynum +# cd /etc/opt/polynum # cp /usr/share/doc/polynum/local_settings.py.example local_settings.py # vi local_settings.py @@ -182,12 +183,12 @@ dans /usr/share/doc/polynum/, il vous suffit donc de faire :

Configuration de l'authentification

Polynum peut authentifier les utilisateurs via CAS et LDAP. Dans -/etc/polynum/local_settings.py adapter les paramètres suivants +/etc/opt/polynum/local_settings.py adapter les paramètres suivants :

-(... extrait de /etc/polynum/local_settings.py ...) +(... extrait de /etc/opt/polynum/local_settings.py ...) CAS_SERVER_URL = "https://cas.univ.fr/" # CAS server URL LDAP_URL = "ldaps://ldap.univ.fr" # LDAP server URL diff --git a/local_settings.py.example b/local_settings.py.example index e560d0a..c29e52e 100644 --- a/local_settings.py.example +++ b/local_settings.py.example @@ -2,41 +2,50 @@ # See settings.py for default values -DEBUG = True # set to False in production ! +DEBUG = True +#DEBUG = False # for production TEMPLATE_DEBUG = DEBUG -# use PostgreSQL in production 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. + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': '/tmp/polynum', } -} + +# 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. +# } +#} # -# Upload directory +# Upload directory (polynum must have read+write permissions on it) # -DOCUMENTS_UPLOAD_DIRECTORY = '/opt/polynum/uploads/' +MEDIA_ROOT = '/var/opt/polynum/media/' # # Authentification with CAS & LDAP # -CAS_SERVER_URL = 'https://www.univ.fr/cas/' # CAS server URL, if empty CAS login is disabled -LDAP_URL = 'ldaps://' # LDAP server URL -LDAP_BIND_DN = '' # DN to authenticate to the LDAP server -LDAP_BIND_PASSWORD = 'abdef' # and its password -LDAP_USER_QUERY = '' # query to retrieve user, %s is the CAS username -LDAP_BASE = '' # base DN for the query +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 # # Design # +# static files -- to create with "polynum-manage.py collectstatic" +STATIC_ROOT = '/opt/polynum/static' # grappelli admin -- see http://readthedocs.org/docs/django-grappelli -GRAPPELLI_ADMIN_TITLE = 'Univ - Administration de PolyNum' +GRAPPELLI_ADMIN_TITLE = 'Administration de PolyNum' # templates TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". @@ -47,7 +56,7 @@ TEMPLATE_DIRS = ( ) # -# OAI METADATA +# OAI METADATA for OAI-PMH exports # OAI_ADMIN_EMAIL = 'admin@univ.fr' OAI_TEXT = 'Polynum documents'