Ce serveur Gitlab sera éteint le 30 juin 2020, pensez à migrer vos projets vers les serveurs gitlab-research.centralesupelec.fr et gitlab-student.centralesupelec.fr !

settings.py 1.74 KB
Newer Older
1
# -*- mode: python; coding: utf-8 -*-
2 3 4 5
# Re2o est un logiciel d'administration développé initiallement au rezometz. Il
# se veut agnostique au réseau considéré, de manière à être installable en
# quelques clics.
#
6
# Copyright © 2018 Maël Kervella
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

22
"""Settings specific to the API.
23 24 25 26 27 28
"""

# RestFramework config for API
REST_FRAMEWORK = {
    'URL_FIELD_NAME': 'api_url',
    'DEFAULT_AUTHENTICATION_CLASSES': (
29
        'api.authentication.ExpiringTokenAuthentication',
30 31 32
        'rest_framework.authentication.SessionAuthentication',
    ),
    'DEFAULT_PERMISSION_CLASSES': (
33
        'api.permissions.AutodetectACLPermission',
34
    ),
35
    'DEFAULT_PAGINATION_CLASS': 'api.pagination.PageSizedPagination',
36
    'PAGE_SIZE': 100
37
}
38 39 40 41 42 43

# API permission settings
API_CONTENT_TYPE_APP_LABEL = 'api'
API_CONTENT_TYPE_MODEL = 'api'
API_PERMISSION_NAME = 'Can use the API'
API_PERMISSION_CODENAME = 'use_api'
44 45 46 47 48

# Activate token authentication
API_APPS = (
    'rest_framework.authtoken',
)
49 50

# The expiration time for an authentication token
51
API_TOKEN_DURATION = 86400 # 24 hours