black & isort
This commit is contained in:
parent
5d3f840de1
commit
2c92f35a75
6 changed files with 103 additions and 111 deletions
|
@ -1,6 +1,7 @@
|
|||
from authens.backends import ENSCASBackend as AuthENSBackend
|
||||
from authens.utils import parse_entrance_year
|
||||
|
||||
|
||||
class ENSCASBackend(AuthENSBackend):
|
||||
# Override AuthENS backend user creation to implement the @<promo> logic
|
||||
|
||||
|
|
|
@ -10,9 +10,10 @@ https://docs.djangoproject.com/en/1.7/ref/settings/
|
|||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
import os
|
||||
|
||||
from django.urls import reverse_lazy
|
||||
|
||||
from .secrets import SECRET_KEY, GOOGLE_API_KEY, MAPBOX_API_KEY
|
||||
from .secrets import GOOGLE_API_KEY, MAPBOX_API_KEY, SECRET_KEY
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
||||
|
||||
|
@ -24,68 +25,65 @@ ALLOWED_HOSTS = []
|
|||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.gis',
|
||||
'django.contrib.sites',
|
||||
|
||||
'django_elasticsearch_dsl',
|
||||
|
||||
"django.contrib.admin",
|
||||
"django.contrib.auth",
|
||||
"django.contrib.contenttypes",
|
||||
"django.contrib.sessions",
|
||||
"django.contrib.messages",
|
||||
"django.contrib.staticfiles",
|
||||
"django.contrib.gis",
|
||||
"django.contrib.sites",
|
||||
"django_elasticsearch_dsl",
|
||||
#'allauth', # Uncomment that part when you
|
||||
#'allauth.account', # apply migration
|
||||
#'allauth.socialaccount', # Allauth -> AuthENS
|
||||
|
||||
'simple_email_confirmation',
|
||||
'authens',
|
||||
'tastypie',
|
||||
'braces',
|
||||
'tinymce',
|
||||
'taggit',
|
||||
'taggit_autosuggest',
|
||||
'avisstage'
|
||||
"simple_email_confirmation",
|
||||
"authens",
|
||||
"tastypie",
|
||||
"braces",
|
||||
"tinymce",
|
||||
"taggit",
|
||||
"taggit_autosuggest",
|
||||
"avisstage",
|
||||
]
|
||||
|
||||
MIDDLEWARE = (
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
"django.middleware.security.SecurityMiddleware",
|
||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||
"django.middleware.common.CommonMiddleware",
|
||||
"django.middleware.csrf.CsrfViewMiddleware",
|
||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||
"django.contrib.messages.middleware.MessageMiddleware",
|
||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||
)
|
||||
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"DIRS": [
|
||||
# insert your TEMPLATE_DIRS here
|
||||
],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.i18n',
|
||||
'django.template.context_processors.media',
|
||||
'django.template.context_processors.static',
|
||||
'django.template.context_processors.tz',
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
"APP_DIRS": True,
|
||||
"OPTIONS": {
|
||||
"context_processors": [
|
||||
"django.contrib.auth.context_processors.auth",
|
||||
"django.template.context_processors.debug",
|
||||
"django.template.context_processors.i18n",
|
||||
"django.template.context_processors.media",
|
||||
"django.template.context_processors.static",
|
||||
"django.template.context_processors.tz",
|
||||
"django.template.context_processors.request",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
ROOT_URLCONF = 'experiENS.urls'
|
||||
ROOT_URLCONF = "experiENS.urls"
|
||||
|
||||
WSGI_APPLICATION = 'experiENS.wsgi.application'
|
||||
WSGI_APPLICATION = "experiENS.wsgi.application"
|
||||
|
||||
|
||||
# Database
|
||||
|
@ -94,9 +92,9 @@ WSGI_APPLICATION = 'experiENS.wsgi.application'
|
|||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/1.7/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'fr'
|
||||
LANGUAGE_CODE = "fr"
|
||||
|
||||
TIME_ZONE = 'Europe/Paris'
|
||||
TIME_ZONE = "Europe/Paris"
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
|
@ -109,37 +107,37 @@ SITE_ID = 1
|
|||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/1.7/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_URL = "/static/"
|
||||
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
'django.contrib.auth.backends.ModelBackend',
|
||||
'experiENS.auth.ENSCASBackend',
|
||||
"django.contrib.auth.backends.ModelBackend",
|
||||
"experiENS.auth.ENSCASBackend",
|
||||
)
|
||||
|
||||
CAS_SERVER_URL = "https://cas.eleves.ens.fr/" #SPI CAS
|
||||
CAS_SERVER_URL = "https://cas.eleves.ens.fr/" # SPI CAS
|
||||
|
||||
AUTHENS_USE_OLDCAS = False
|
||||
|
||||
LOGIN_URL = reverse_lazy('authens:login')
|
||||
LOGOUT_URL = reverse_lazy('authens:logout')
|
||||
LOGIN_REDIRECT_URL = reverse_lazy('avisstage:perso')
|
||||
LOGOUT_REDIRECT_URL = reverse_lazy('avisstage:index')
|
||||
LOGIN_URL = reverse_lazy("authens:login")
|
||||
LOGOUT_URL = reverse_lazy("authens:logout")
|
||||
LOGIN_REDIRECT_URL = reverse_lazy("avisstage:perso")
|
||||
LOGOUT_REDIRECT_URL = reverse_lazy("avisstage:index")
|
||||
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'handlers': {
|
||||
'file': {
|
||||
'level': 'INFO',
|
||||
'class': 'logging.FileHandler',
|
||||
'filename': os.path.join(BASE_DIR, 'recherche.log'),
|
||||
"version": 1,
|
||||
"disable_existing_loggers": False,
|
||||
"handlers": {
|
||||
"file": {
|
||||
"level": "INFO",
|
||||
"class": "logging.FileHandler",
|
||||
"filename": os.path.join(BASE_DIR, "recherche.log"),
|
||||
},
|
||||
},
|
||||
'loggers': {
|
||||
'recherche': {
|
||||
'handlers': ['file'],
|
||||
'level': 'INFO',
|
||||
'propagate': True,
|
||||
"loggers": {
|
||||
"recherche": {
|
||||
"handlers": ["file"],
|
||||
"level": "INFO",
|
||||
"propagate": True,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@ from .settings_base import *
|
|||
DEBUG = True
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.contrib.gis.db.backends.spatialite',
|
||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||
"default": {
|
||||
"ENGINE": "django.contrib.gis.db.backends.spatialite",
|
||||
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,35 +13,30 @@ USE_DEBUG_TOOLBAR = False
|
|||
|
||||
if USE_DEBUG_TOOLBAR:
|
||||
INSTALLED_APPS += [
|
||||
'debug_toolbar',
|
||||
"debug_toolbar",
|
||||
]
|
||||
|
||||
MIDDLEWARE = (
|
||||
'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||
) + MIDDLEWARE
|
||||
MIDDLEWARE = ("debug_toolbar.middleware.DebugToolbarMiddleware",) + MIDDLEWARE
|
||||
|
||||
INTERNAL_IPS = ['127.0.0.1']
|
||||
INTERNAL_IPS = ["127.0.0.1"]
|
||||
|
||||
SPATIALITE_LIBRARY_PATH = 'mod_spatialite'
|
||||
SPATIALITE_LIBRARY_PATH = "mod_spatialite"
|
||||
|
||||
STATIC_ROOT = "/home/evarin/Bureau/experiENS/static/"
|
||||
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
||||
|
||||
STATIC_URL = "/experiens/static/"
|
||||
|
||||
ELASTICSEARCH_DSL = {
|
||||
'default': {
|
||||
'hosts': 'localhost:9200'
|
||||
},
|
||||
"default": {"hosts": "localhost:9200"},
|
||||
}
|
||||
|
||||
|
||||
CLIPPER_LDAP_SERVER = 'ldaps://localhost:636'
|
||||
CLIPPER_LDAP_SERVER = "ldaps://localhost:636"
|
||||
|
||||
# Changer à True pour développer avec ES
|
||||
USE_ELASTICSEARCH = False
|
||||
|
||||
if not USE_ELASTICSEARCH:
|
||||
INSTALLED_APPS.remove('django_elasticsearch_dsl')
|
||||
|
||||
INSTALLED_APPS.remove("django_elasticsearch_dsl")
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
from .settings_base import *
|
||||
import os
|
||||
import sys
|
||||
|
||||
import os, sys
|
||||
from django.core.urlresolvers import reverse_lazy
|
||||
|
||||
from .settings_base import *
|
||||
|
||||
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
BASE_DIR = os.path.dirname(PROJECT_DIR)
|
||||
|
||||
|
@ -10,9 +12,7 @@ DEBUG = False
|
|||
|
||||
ALLOWED_HOSTS = ["www.eleves.ens.fr"]
|
||||
|
||||
ADMINS = (
|
||||
('Robin Champenois', 'champeno@clipper.ens.fr'),
|
||||
)
|
||||
ADMINS = (("Robin Champenois", "champeno@clipper.ens.fr"),)
|
||||
|
||||
ADMIN_LOGINS = [
|
||||
"champeno",
|
||||
|
@ -22,33 +22,31 @@ SERVER_EMAIL = "experiens@www.eleves.ens.fr"
|
|||
|
||||
ROOT_URL = "/experiens/"
|
||||
|
||||
WSGI_APPLICATION = 'experiENS.wsgi.application'
|
||||
WSGI_APPLICATION = "experiENS.wsgi.application"
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.contrib.gis.db.backends.postgis',
|
||||
'NAME': 'experiens',
|
||||
'USER': 'experiens',
|
||||
'PASSWORD': '',
|
||||
'HOST': '',
|
||||
'PORT': '5432',
|
||||
"default": {
|
||||
"ENGINE": "django.contrib.gis.db.backends.postgis",
|
||||
"NAME": "experiens",
|
||||
"USER": "experiens",
|
||||
"PASSWORD": "",
|
||||
"HOST": "",
|
||||
"PORT": "5432",
|
||||
}
|
||||
}
|
||||
|
||||
STATIC_URL = ROOT_URL + 'static/'
|
||||
MEDIA_URL = ROOT_URL + 'media/'
|
||||
STATIC_URL = ROOT_URL + "static/"
|
||||
MEDIA_URL = ROOT_URL + "media/"
|
||||
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, "static/")
|
||||
|
||||
EMAIL_HOST = "nef.ens.fr"
|
||||
|
||||
|
||||
ELASTICSEARCH_DSL = {
|
||||
'default': {
|
||||
'hosts': '127.0.0.1:9200'
|
||||
},
|
||||
"default": {"hosts": "127.0.0.1:9200"},
|
||||
}
|
||||
|
||||
|
||||
CLIPPER_LDAP_SERVER = 'ldaps://ldap.spi.ens.fr:636'
|
||||
CLIPPER_LDAP_SERVER = "ldaps://ldap.spi.ens.fr:636"
|
||||
DEFAULT_FROM_EMAIL = "experiens-no-reply@www.eleves.ens.fr"
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
from django.conf import settings
|
||||
from django.urls import include, path
|
||||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
|
||||
urlpatterns = [
|
||||
path('', include('avisstage.urls')),
|
||||
|
||||
|
||||
path("", include("avisstage.urls")),
|
||||
path("authens/", include("authens.urls")),
|
||||
|
||||
path('tinymce/', include('tinymce.urls')),
|
||||
path('taggit_autosuggest/', include('taggit_autosuggest.urls')),
|
||||
path('admin/', admin.site.urls),
|
||||
path("tinymce/", include("tinymce.urls")),
|
||||
path("taggit_autosuggest/", include("taggit_autosuggest.urls")),
|
||||
path("admin/", admin.site.urls),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
import debug_toolbar
|
||||
|
||||
urlpatterns = [
|
||||
path('__debug__/', include(debug_toolbar.urls)),
|
||||
path("__debug__/", include(debug_toolbar.urls)),
|
||||
] + urlpatterns
|
||||
|
|
|
@ -8,7 +8,9 @@ https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
|
|||
"""
|
||||
|
||||
import os
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "experiENS.settings")
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
application = get_wsgi_application()
|
||||
|
|
Loading…
Reference in a new issue