Skip to content
Snippets Groups Projects
Commit 36caad2c authored by Fabien  MAREUIL's avatar Fabien MAREUIL
Browse files

increase token life

parent 4e87d3b5
No related branches found
No related tags found
2 merge requests!54merge with master,!53Clean code
......@@ -20,26 +20,30 @@ from socket import gethostname, gethostbyname
from ippisite import db_finder
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PERSISTENT_DIR = os.path.join(BASE_DIR, 'persistent')
PERSISTENT_DIR = os.path.join(BASE_DIR, "persistent")
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = config("SECRET_KEY", default="&qc$2x5p&!qwvu2r=)sjp*jgg8a7ss97g8lwpennmu(q9ty4o$")
SECRET_KEY = config(
"SECRET_KEY", default="&qc$2x5p&!qwvu2r=)sjp*jgg8a7ss97g8lwpennmu(q9ty4o$"
)
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config("DJANGO_DEBUG", default="False").upper() == "TRUE"
SHOW_TOOLBAR_CALLBACK = True
ALLOWED_HOSTS = [
s.strip() for s in config("ALLOWED_HOSTS", default="*").split(",")
] + [
ALLOWED_HOSTS = [s.strip() for s in config("ALLOWED_HOSTS", default="*").split(",")] + [
gethostbyname(gethostname()),
] # for k8s probe compatibility
CSRF_TRUSTED_ORIGINS = ['https://*.pasteur.fr', 'https://*.pasteur.cloud', 'https://*.dev.pasteur.cloud']
CSRF_TRUSTED_ORIGINS = [
"https://*.pasteur.fr",
"https://*.pasteur.cloud",
"https://*.dev.pasteur.cloud",
]
INTERNAL_IPS = ["127.0.0.1", "localhost"]
......@@ -58,7 +62,7 @@ INSTALLED_APPS = [
"django_extensions",
"django_celery_results",
"crispy_forms",
'crispy_bootstrap4',
"crispy_bootstrap4",
"live_settings",
"formtools",
"debug_toolbar",
......@@ -123,11 +127,11 @@ if config("USE_SQLITE_AS_DB", default="False").upper() == "TRUE":
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(PERSISTENT_DIR, 'db.sqlite3'),
"NAME": os.path.join(PERSISTENT_DIR, "db.sqlite3"),
}
}
else:
POSTGRES_HOST = config("POSTGRES_HOST", '')
POSTGRES_HOST = config("POSTGRES_HOST", "")
if not POSTGRES_HOST:
POSTGRES_HOST = db_finder.get_db_ip()
DATABASES = {
......@@ -198,17 +202,17 @@ AUTHENTICATION_BACKENDS = (
REST_FRAMEWORK = {
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination",
"PAGE_SIZE": 20,
'DEFAULT_AUTHENTICATION_CLASSES': (
'ippisite.authentication.ExpiringTokenAuthentication',
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication',
"DEFAULT_AUTHENTICATION_CLASSES": (
"ippisite.authentication.ExpiringTokenAuthentication",
"rest_framework.authentication.BasicAuthentication",
"rest_framework.authentication.SessionAuthentication",
),
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.AllowAny',
]
"DEFAULT_PERMISSION_CLASSES": [
"rest_framework.permissions.AllowAny",
],
}
TOKEN_EXPIRED_AFTER_SECONDS = 86400
TOKEN_EXPIRED_AFTER_SECONDS = 172800
SITE_ID = 1
......@@ -220,7 +224,7 @@ LOGOUT_REDIRECT_URL = "/"
MEDIA_URL = "/media/"
MEDIA_ROOT = PERSISTENT_DIR + "/media/"
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
################################################################################
# fingerprints used to compute Drugbank similarity using openbabel
......@@ -242,12 +246,14 @@ MARVINJS_APIKEY = config("MARVINJS_APIKEY", default=None)
GALAXY_BASE_URL = config("GALAXY_BASE_URL", default=None)
GALAXY_APIKEY = config("GALAXY_APIKEY", default=None)
GALAXY_COMPOUNDPROPERTIES_WORKFLOWID = config("GALAXY_COMPOUNDPROPERTIES_WORKFLOWID", default=None)
GALAXY_COMPOUNDPROPERTIES_WORKFLOWID = config(
"GALAXY_COMPOUNDPROPERTIES_WORKFLOWID", default=None
)
# celery setting.
REDIS_HOSTNAME = config("REDIS_HOSTNAME", "redis-local")
REDIS_USER = config("REDIS_USER", default='')
REDIS_PASSWORD = config("REDIS_PASSWORD", default='')
REDIS_USER = config("REDIS_USER", default="")
REDIS_PASSWORD = config("REDIS_PASSWORD", default="")
if REDIS_PASSWORD:
CELERY_BROKER_URL = f"redis://{REDIS_USER}:{REDIS_PASSWORD}@{REDIS_HOSTNAME}:6379"
else:
......@@ -277,7 +283,9 @@ MAINTENANCE_MODE = None
# if you want to use the db or cache, you can create a custom backend
# custom backends must extend 'maintenance_mode.backends.AbstractStateBackend' class
# and implement get_value(self) and set_value(self, val) methods
MAINTENANCE_MODE_STATE_BACKEND = "live_settings.maintenance_mode_storage.LiveSettingsStorageBackend"
MAINTENANCE_MODE_STATE_BACKEND = (
"live_settings.maintenance_mode_storage.LiveSettingsStorageBackend"
)
# if True admin site will not be affected by the maintenance-mode page
MAINTENANCE_MODE_IGNORE_ADMIN_SITE = True
# if True anonymous users will not see the maintenance-mode page
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment