From 8b046ea48ec3be30203d8a04bed5030fc9cf0827 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Tue, 18 Sep 2018 15:14:20 +0200 Subject: [PATCH] Add a little more default settings --- .gitmodules | 2 +- app/bin/app.sh | 2 +- app/settings.py | 144 ++++++++++++++++++++++++++---- bin | 2 +- lib/grappelli-safe | 2 +- lib/mezzanine | 2 +- lib/mezzanine-agenda | 2 +- lib/mezzanine-organization | 2 +- lib/mezzanine-organization-themes | 2 +- 9 files changed, 137 insertions(+), 23 deletions(-) diff --git a/.gitmodules b/.gitmodules index e7f2b3a2..53cf1ea1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -31,7 +31,7 @@ path = lib/mezzanine-organization url = git@github.com:Ircam-Web/mezzanine-organization.git branch-master = master - branch-dev = test + branch-dev = dev ignore = dirty [submodule "lib/cartridge"] path = lib/cartridge diff --git a/app/bin/app.sh b/app/bin/app.sh index b37b7e81..0390cef0 100755 --- a/app/bin/app.sh +++ b/app/bin/app.sh @@ -25,7 +25,7 @@ gid='www-data' # pip install -e /srv/lib/mypackage... # Install (staging) libs -# /srv/bin/build/local/setup_lib.sh +/srv/bin/build/local/setup_lib.sh # waiting for other services sh $app/bin/wait.sh diff --git a/app/settings.py b/app/settings.py index ed22ba61..d7b96156 100644 --- a/app/settings.py +++ b/app/settings.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki +# Copyright (c) 2016-2018 Ircam +# Copyright (c) 2016-2018 Guillaume Pellerin +# Copyright (c) 2016-2018 Emilie Zawadzki # This file is part of mezzanine-organization. @@ -19,6 +19,26 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . + +from __future__ import absolute_import, unicode_literals + +import os +from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse_lazy +import ldap, logging +from django.core.urlresolvers import reverse_lazy +from django_auth_ldap.config import LDAPSearch, GroupOfNamesType + +DEBUG = True if os.environ.get('DEBUG') == 'True' else False + +import warnings +warnings.filterwarnings( + 'ignore', r"DateTimeField .* received a naive datetime", + RuntimeWarning, r'django\.db\.models\.fields') + +SILENCED_SYSTEM_CHECKS = ['fields.W342',] + + ################################### # MEZZANINE ORGANIZATION SETTINGS # ################################### @@ -29,6 +49,112 @@ except ImportError as e: raise e +######################## +# MAIN DJANGO SETTINGS # +######################## + +# Hosts/domain names that are valid for this site; required if DEBUG is False +# See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts +ALLOWED_HOSTS = ['*'] + +# Local time zone for this installation. Choices can be found here: +# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name +# although not all choices may be available on all operating systems. +# On Unix systems, a value of None will cause Django to use the same +# timezone as the operating system. +# If running in a Windows environment this must be set to the same as your +# system time zone. +TIME_ZONE = 'Europe/Paris' + +# If you set this to True, Django will use timezone-aware datetimes. +USE_TZ = True + +# Whether a user's session cookie expires when the Web browser is closed. +SESSION_EXPIRE_AT_BROWSER_CLOSE = False +SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies" + +SITE_ID = 1 + +# If you set this to False, Django will make some optimizations so as not +# to load the internationalization machinery. +USE_I18N = True +USE_L10N = True + +AUTHENTICATION_BACKENDS = ( + "organization.core.backend.OrganizationLDAPBackend", + "mezzanine.core.auth_backends.MezzanineBackend", + "guardian.backends.ObjectPermissionBackend", +) + + +########## +# LOCALE # +########## + +# Language code for this installation. All choices can be found here: +# http://www.i18nguy.com/unicode/language-identifiers.html +LANGUAGE_CODE = "fr" + +# Supported languages +LANGUAGES = ( + ('fr', _('French')), + ('en', _('English')), +) + +############# +# DATABASES # +############# + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': 'postgres', + 'USER': 'postgres', + 'PASSWORD': os.environ.get('DB_ENV_POSTGRES_PASSWORD'), + 'HOST': 'db', + 'PORT': '5432', + }, +} + + +########################################## +# CUSTOM MEZZANINE ORGANIZATION SETTINGS # +########################################## + +# List of middleware classes to use. Order is important; in the request phase, +# these middleware classes will be applied in the order given, and in the +# response phase the middleware will be applied in reverse order. +MIDDLEWARE_CLASSES += () + +STATICFILES_FINDERS += () + +SEARCH_MODEL_CHOICES += () + +PAGES_MODELS += () + + +################ +# APPLICATIONS # +################ + +INSTALLED_APPS += [] + +CUSTOM_MODULES = False + +if CUSTOM_MODULES: + INSTALLED_APPS += [ + "organization.custom", + ] + +########## +# THEMES # +########## + +HOST_THEMES = [ + ('example.com', 'organization_themes.ircam-www-theme'), +] + + ################## # LOCAL SETTINGS # ################## @@ -42,18 +168,6 @@ except ImportError as e: if "local_settings" not in str(e): raise e -# Please define THEME_APP in local_settings -INSTALLED_APPS.insert(1, 'organization_themes.ircam-www-theme') - - -# Themes -HOST_THEMES = [ - ('example.com', 'organization_themes.ircam-www-theme'), -] - -# Locales -LOCALE_PATHS += (os.path.join(PROJECT_ROOT, 'lib/mezzanine-organization-themes/organization_themes/ircam-www-theme/locale/'),) - #################### # DYNAMIC SETTINGS # #################### diff --git a/bin b/bin index 53164550..e8e0c289 160000 --- a/bin +++ b/bin @@ -1 +1 @@ -Subproject commit 531645508807efca744dc4f6b5f2a28ec7ab8b5b +Subproject commit e8e0c2897f07c70f4723b359d2957faeff335ef4 diff --git a/lib/grappelli-safe b/lib/grappelli-safe index 1ea336a5..66109d3f 160000 --- a/lib/grappelli-safe +++ b/lib/grappelli-safe @@ -1 +1 @@ -Subproject commit 1ea336a5e767fdbaca08811f859e8a0d93e01023 +Subproject commit 66109d3f698d57c981bcd35764bfdea8b50d6dc2 diff --git a/lib/mezzanine b/lib/mezzanine index 1ec7ffd5..c6a7b6bc 160000 --- a/lib/mezzanine +++ b/lib/mezzanine @@ -1 +1 @@ -Subproject commit 1ec7ffd5e26064a284eaeafb26ec45e383e3157c +Subproject commit c6a7b6bcecc529b01fcbc6b91798b79219e2dff7 diff --git a/lib/mezzanine-agenda b/lib/mezzanine-agenda index 198696f9..e915a18d 160000 --- a/lib/mezzanine-agenda +++ b/lib/mezzanine-agenda @@ -1 +1 @@ -Subproject commit 198696f9bebdf3f0b7090de0a1aab8299470b58e +Subproject commit e915a18d2c8d156060a7416a6be51eb62f0d50f8 diff --git a/lib/mezzanine-organization b/lib/mezzanine-organization index 8fb389db..a6f47e1d 160000 --- a/lib/mezzanine-organization +++ b/lib/mezzanine-organization @@ -1 +1 @@ -Subproject commit 8fb389dbb96a18761cfb535208d3770a70a1e028 +Subproject commit a6f47e1df615f258f333c13b3c5ae0d06a05e2da diff --git a/lib/mezzanine-organization-themes b/lib/mezzanine-organization-themes index b5499422..3b0f1da4 160000 --- a/lib/mezzanine-organization-themes +++ b/lib/mezzanine-organization-themes @@ -1 +1 @@ -Subproject commit b549942259c15cfa1f7fe8bad1a995ce6837ef0c +Subproject commit 3b0f1da45922e476c65749e8590bca054f470277 -- 2.39.5