Arborescence des pages

Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.

...

Bloc de code
languagepy
titleServeur(s) Pod / Fichier custom/settings_local.py
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _

##
# DEBUG mode activation
#
# https://docs.djangoproject.com/en/1.11/ref/settings/#debug
#
# SECURITY WARNING: MUST be set to False when deploying into production.
DEBUG = False

SECRET_KEY = 'xxxxxxxxxxxxxxxxxxxxxxx'

# Droit des fichiers uploadés
FILE_UPLOAD_PERMISSIONS = 0o644


# Permet d'utiliser la mise en ligne fragmentée (qui permet de reprendre la mise en ligne lors de problèmes de connexion)
USE_CHUNKED_UPLOAD = True

##
# A list of strings representing the host/domain names
# that this Django site is allowed to serve.
#
# https://docs.djangoproject.com/en/1.11/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['162.38.xx.xx', 'xxxxx.umontpellier.fr']

##
# A tuple that lists people who get code error notifications
#   when DEBUG=False and a view raises an exception.
#
# https://docs.djangoproject.com/fr/1.11/ref/settings/#std:setting-ADMINS
#
ADMINS = (
    ('Admin Pod', 'xxx.xxx@umontpellier.fr'),
)
##
# A dictionary containing the settings for all databases
# to be used with Django.
#
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
"""
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': '/data/www/podtest/django_projects/podv2/db.sqlite',
    }
}
"""

# MySQL settings
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'xxx',
        'USER': 'xxx',
        'PASSWORD': 'xxx',
        'HOST': 'xxxxx.umontpellier.fr',
        'PORT': '',
        'OPTIONS': {'init_command':"SET storage_engine=INNODB, sql_mode='STRICT_TRANS_TABLES', innodb_strict_mode=1;"}
        #'OPTIONS': {'init_command':"SET storage_engine=INNODB;"}
    }
}

RESTRICT_EDIT_VIDEO_ACCESS_TO_STAFF_ONLY = True

VIDEO_MAX_UPLOAD_SIZE = 4

FILE_ALLOWED_EXTENSIONS = ( 'doc', 'docx', 'odt', 'pdf', 'xls', 'xlsx', 'ods', 'ppt', 'pptx', 'txt', 'html', 'htm', 'vtt', 'srt', 'webm', 'ts', )
IMAGE_ALLOWED_EXTENSIONS = ( 'jpg', 'jpeg', 'bmp', 'png', 'gif', 'tiff', )
FILE_MAX_UPLOAD_SIZE = 20

##
# THIRD PARTY APPS OPTIONNAL
#
USE_PODFILE = True
THIRD_PARTY_APPS = ['live', 'enrichment']

# Nouveaute v2
AUTH_TYPE = (('local', ('local')), ('CAS', 'CAS'))

USE_CAS = True
CAS_VERSION = '3'
CAS_SERVER_URL = 'https://xxx.umontpellier.fr/cas/'
CAS_GATEWAY = False
POPULATE_USER = 'LDAP'
AUTH_CAS_USER_SEARCH = 'user'

CREATE_GROUP_FROM_AFFILIATION = False
AFFILIATION_STAFF = ('faculty', 'employee', 'researcher', 'affiliate')

LDAP_SERVER = {'url': 'xxxxx.umontpellier.fr', 'port': 389, 'use_ssl': False}
AUTH_LDAP_BIND_DN = 'xxx'
AUTH_LDAP_BIND_PASSWORD =  'xxx'
AUTH_LDAP_BASE_DN = 'ou=people,dc=umontpellier,dc=fr'
AUTH_LDAP_USER_SEARCH = (AUTH_LDAP_BASE_DN, "(uid=%(uid)s)")

##
# Internationalization and localization.
#
#   https://docs.djangoproject.com/en/1.8/ref/settings/#globalization-i18n-l10n
#
LANGUAGE_CODE = 'fr'
LANGUAGES = (
    ('fr', 'Fran?§ais'),
    ('en', 'English')
)
MODELTRANSLATION_DEFAULT_LANGUAGE = 'fr'
MODELTRANSLATION_FALLBACK_LANGUAGES = ('fr', 'en')

##
# A string representing the time zone for this installation.
#
#   https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
#
TIME_ZONE = 'Europe/Paris'

##
# Dynamic files (user managed content: videos, subtitles, documents, etc...)
#
# https://docs.djangoproject.com/en/1.11/ref/settings/#media-url
# https://docs.djangoproject.com/en/1.11/ref/settings/#media-root
#
# WARNING: this folder must have previously been created.
MEDIA_URL = '/media/'
MEDIA_ROOT = '/data/www/%userpod%/media'

FILE_UPLOAD_TEMP_DIR = os.path.join(os.path.sep, 'var', 'tmp')

##
# eMail settings
#
# https://docs.djangoproject.com/en/1.11/ref/settings/#email-host
# https://docs.djangoproject.com/en/1.11/ref/settings/#email-port
# https://docs.djangoproject.com/en/1.11/ref/settings/#default-from-email
#
#   username: EMAIL_HOST_USER
#   password: EMAIL_HOST_PASSWORD
#
EMAIL_HOST = 'smtp-xxx.umontpellier.fr'
EMAIL_PORT = 25
DEFAULT_FROM_EMAIL = 'xxx.xxx@umontpellier.fr'

# https://docs.djangoproject.com/fr/1.11/ref/settings/#std:setting-SERVER_EMAIL
SERVER_EMAIL = 'xxx.xxx@umontpellier.fr'

MENUBAR_SHOW_STAFF_OWNERS_ONLY = True
HOMEPAGE_SHOWS_RESTRICTED = True
##
# List of Elasticsearch urls, like ['host1', 'host2', ...].
#
#   http://elasticutils.readthedocs.io/en/latest/django.html#django.conf.settings.ES_URLS
#
ES_URL = ['http://162.38.xx.xx:9200/']

FFMPEG = '/opt/ffmpeg/ffmpeg/ffmpeg'
FFPROBE = '/opt/ffmpeg/ffmpeg/ffprobe'

# Encode with Celery
CELERY_TO_ENCODE = True
CELERY_NAME = "pod_project"
CELERY_BACKEND = "amqp"
CELERY_BROKER = "amqp://pod:xxxx@162.38.xx.xx//"

# Template Settings
TEMPLATE_VISIBLE_SETTINGS = {
     'TITLE_SITE': 'Vidéo - Université de Montpellier',
     'TITLE_ETB': 'Université de Montpellier',
     'LOGO_SITE': 'custom/um_pod.png',
     'LOGO_COMPACT_SITE': 'custom/logo_black_compact.png',
     'LOGO_ETB': 'custom/um.png',
     'LOGO_PLAYER': 'custom/logo_player.png',
     'FOOTER_TEXT': (
         '163 rue Auguste Broussonnet',
         '34090 Montpellier',
         ('<a href="https://goo.gl/maps/RHsfxME59Fp"'
          ' target="_blank">Google maps</a>')
     ),
     'LINK_PLAYER': 'https://www.umontpellier.fr',
     'CSS_OVERRIDE': 'custom/um.css',
     'FAVICON': 'custom/favicon.png'
}

SUBJECT_CHOICES = ( ('', '-----'), ('info', _('Request more information')), ('request_password', _('Password request for a video')), ('inappropriate_content', _('Report inappropriate content')),
('bug', _('Correction or bug report')), ('other', _('Other (please specify)')) )

# Templates spécifiques UM
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['/data/www/%userpod%/django_projects/podv2/pod/custom/templates'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
                # Local contexts
                'pod.main.context_processors.context_settings',
                'pod.main.context_processors.context_navbar'
            ],
        },
    },
]

DEFAULT_THUMBNAIL = 'custom/default.png'

# Utile pour la reprise de l'existant (adresse de Pod v1 en production)
FROM_URL = 'https://video.umontpellier.fr/media/'

...

Bloc de code
languagebash
themeMidnight
titleServeur(s) Pod / Compte %userpod%
[%userpod%@ts-sun-video%userpod%][/]# mkdir /data/www/%userpod%/django_projects/podv2/pod/static/custom

...

  • Réaliser une configuration dans le fichier settings_local.py
Bloc de code
languagetextpy
themeEmacs
titleServeur(s) Pod / Compte %userpod%
# Templates spécifiques UM
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['/data/www/%userpod%/django_projects/podv2/pod/custom/templates'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
                # Local contexts
                'pod.main.context_processors.context_settings',
                'pod.main.context_processors.context_navbar'
            ],
        },
    },
]

...

Bloc de code
languagebash
[root]# yum install mod_wsgi
[root]# yum install expat-devel
[root]# yum install httpd-devel
[root]# yum install python36u-mod_wsgi
[root]# # ATTENTION: nouveau fichier créé /etc/httpd/conf.modules.d/10-wsgi-python3.6.conf
[root]# # Configurer 10-wsgi.conf
[root]# # Configurer pod.conf
[root]# chmod 755 /data/www/%userpod%/django_projects/podv2/pod/wsgi.py

[%userpod%@ts-sun-video%userpod%][/data/www/%userpod%/django_projects/podv2]# pip3 install requests

...

Bloc de code
languagebash
titleServeur(s) Pod / Compte root
[root]# yum install pcre-devel
[root]# cd /data/www/%userod%/django_projects/podv2/
[root /data/www/%userpod%/django_projects/podv2]#  pip3 install uwsgi

Configuration uWSGI

...

Bloc de code
languagebash
titleServeur(s) Pod / Migration v2.0.4 vers 2.1.0 (compte %userpod%)
[%userpod%@ts-sun-video%userpod% ~]# cd
[%userpod%@ts-sun-video%userpod% ~]# source .bashrc
[%userpod%@ts-sun-video%userpod% ~]# cd /data/www/%userpod%/django_projects/podv2
[%userpod%@ts-sun-video%userpod% /data/www/%userpod%/django_projects/podv2]# workon django_pod
(django_pod) [%userpod%@ts-sun-video%userpod%][/data/www/%userpod%/django_projects/podv2] git pull
(django_pod) [%userpod%@ts-sun-video%userpod%][/data/www/%userpod%/django_projects/podv2] python manage.py makemigrations
(django_pod) [%userpod%@ts-sun-video%userpod%][/data/www/%userpod%/django_projects/podv2] python manage.py migrate
(django_pod) [%userpod%@ts-sun-video%userpod%][/data/www/%userpod%/django_projects/podv2] python manage.py collectstatic

...

Il est nécessaire de vérifier / réaliser les étapes suivantes à chaque migration :

  • la traduction
  • la gestion des fichiers statiques, utiles au module H5P

...

languagebash
titleServeur(s) Pod / Copie de fichiers statiques (compte %userpod%)

...

  •  
  • les templates spécifiques (footer.html, 404.html....) doivent, dans certains cas, être modifiés, en cas de changement majeur.
  • les autres spécificités qui n'ont pas pu être pris en compte dans le système de répertoire custom.