Projet

Général

Profil

Bug #5960

Simplify settings.py

Ajouté par Benjamin Dauvergne il y a plus de 9 ans. Mis à jour il y a environ 9 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Catégorie:
-
Version cible:
Début:
17 novembre 2014
Echéance:
% réalisé:

100%

Temps estimé:
Patch proposed:
Oui
Planning:

Description

Current settings.py does too much, it contains default settings for Django, default settings for A2 settings, and try to provider recipe for distribution integration.

  • It should only contains default for Django settings adapted to development. All A2 default settings should be in an app_settings.py file.
  • Sentry, django-debug-toolbar and logging should not be configurer in the default settings.
  • Extraction of settings from environment should be removed and left to packaging

Révisions associées

Révision 54d03aa5 (diff)
Ajouté par Benjamin Dauvergne il y a environ 9 ans

Convert urls.py in OpenID IdP for direct import of views (refs #5960)

Révision f3481b36 (diff)
Ajouté par Benjamin Dauvergne il y a environ 9 ans

Remove IDP_OPENID setting, rename it A2_IDP_OPENID_ENABLE and store default in an app_settings.py file (refs #5960)

Révision e7535f03 (diff)
Ajouté par Benjamin Dauvergne il y a environ 9 ans

Do not cache settings in disco_responder use late binding (refs #5960)

Révision 65567768 (diff)
Ajouté par Benjamin Dauvergne il y a environ 9 ans

Refactor default settings for the SAML 2.0 IdP (refs #5960)

Révision 1892fefc (diff)
Ajouté par Benjamin Dauvergne il y a environ 9 ans

Remove loading of debug toolbar in urls.py (refs #5960)

Révision 155f8950 (diff)
Ajouté par Benjamin Dauvergne il y a environ 9 ans

Use app_settings to set default value for TEMPLATE_VARS settings (refs #5960)

Révision 97d4e14c (diff)
Ajouté par Benjamin Dauvergne il y a environ 9 ans

Remove the PUSH_PROFILE_UPDATES feature (refs #5960)

Révision 3addecea (diff)
Ajouté par Benjamin Dauvergne il y a environ 9 ans

Remove caching of server object in SAML 2.0 IdP, it's incompatible with multi-tenant (refs #5960)

Révision b47b1519 (diff)
Ajouté par Benjamin Dauvergne il y a environ 9 ans

Simplify settings, remove all extraction from environment (refs #5960)

  • Remove loading of settings using YAML
  • Remove settings for the debug toolbar
  • Remove default TEMPLATE_VARS from settings
  • Remove USE_I18N from settings.py, default is already True
  • Replace all methods of loading configuration files by the environment
    variable DJANGO_CONFIG_FILE
  • Remove magic around cache settings
  • USE_MEMCACHED is now a normal setting variable, it just configure the
    default cache to be memcached and set the session storage to
    cached_db.
  • Remove extraction of LDAP settings from environment
  • Remove extraction of SENTRY_DSN from environment
  • Remove extraction of STATIC_ROOT from environment
  • Remove settings TEMPLATE_LOADER based on DEBUG
  • Remove extraction of all debug related settings from environment
  • Remove extraction of ADMINS and MANAGERS from environment
  • Remove extraction of DATABASES settings from environment
  • Remove extracction of INTERNAL_IPS from environment
  • Use Django default for message storage
  • Remove platform defaults and extraction from environement for
    TEMPLATE_DIRS, STATICFILES_DIRS and LOCALE_PATHS, only keep projects
    paths
  • Remove extraction from environment for PASSWORD_HASHERS
  • Remove extraction of A2_IDP_SAML_ENABLE from environment
  • Remove setting variable PROJECT_DIR, PROJECT_NAME, VAR_DIR and ETC_DIR
    which are no more used
  • Remove defaults from settings.py which have default in app_settings.py
    or in Django, or for which we added default value in the code
    - A2_ACCEPT_EMAIL_AUTHENTICATION
    - A2_CAN_RESET_PASSWORD
    - A2_REGISTRATION_CAN_DELETE_ACCOUNT
    - A2_REGISTRATION_EMAIL_IS_UNIQUE
    - REGISTRATION_OPEN
    - ACCOUNT_ACTIVATION_DAYS
    - PASSWORD_RESET_TIMEOUT_DAYS
  • Set acccount activation days
  • Remove SOUTH_TESTS_MIGRATE as we want to test migrations
  • Remove all remaining extractions from environment keep only defaults, segregate legacy settings for later removal
  • Remove LOCAL_METADATA_CACHE_TIMEOUT from settings
  • Remove SENTRY configuration support
  • Remove PUSH_PROFILE_UPDATE from settings
  • Remove IDP_SAML2 setting, it\'s better to keep supporting it from the debian configuration
  • Remove USE_MEMCACHED setting
  • Rename settings.py to default_settings.py
  • Add minimal default settings allowing to start without a local setting
    file

Révision 7ae6ffd6 (diff)
Ajouté par Benjamin Dauvergne il y a environ 9 ans

Add new --config flag to authentic2-ctl (fixes #5960)

--config expects the path to the config file, it --config is not used
the environment variable DJANGO_CONFIG_FILE is used instead.

Historique

#1

Mis à jour par Nickolas Grigoriadis il y a plus de 9 ans

(Sigh, redmine ate my update... Grrr...)

Since trying to comprehend how settings interdepends is quite difficult, I propose an interm solution. We split the settings file into single-purpose sections, so that all interactions with it is consistent. For this to work, it would be best if you segregate it clearly with a description of what it does.

1) Define defaults. Only code allowed here is the get default from ENV code.

2) Here you import the items from config directory and import local_settings.

3) Here you do all the conditional processing, apply plugins, and make sure that each section is preceded by a clear conditional.

I think this would allow you to identify viable A2 settings a bit easier. It would also allow me to override LOGGING if I want to.

#2

Mis à jour par Benjamin Dauvergne il y a plus de 9 ans

Work on this ticket is on this branch:

http://perso.entrouvert.org/~bdauvergne/git/cgit.cgi/authentic2.git/log/?h=wip/clean-settings

Here is a summary of commits:

a690a1e Add new --config flag to authentic2-ctl
69acdf9 Simplify settings Remove loading of settings using YAML
24a8ac1 Remove caching of server object in SAML 2.0 IdP, it's incompatible with multi-tenant
86a0a04 Remove the PUSH_PROFILE_UPDATES feature
1f97203 Use app_settings to set default value for TEMPLATE_VARS settings
7fd21b5 Remove loading of debug toolbar in urls.py
4a3d870 Refactor default settings for the SAML 2.0 IdP
831087d Do not cache settings in disco_responder use late binding
72fa4a9 Remove IDP_OPENID setting, rename it A2_IDP_OPENID_ENABLE and store default in an app_settings.py file
86a8936 Convert urls.py in OpenID IdP for direct import of views
#3

Mis à jour par Serghei Mihai il y a environ 9 ans

Ack

#4

Mis à jour par Benjamin Dauvergne il y a environ 9 ans

  • Assigné à mis à Benjamin Dauvergne
  • Patch proposed changé de Non à Oui
#5

Mis à jour par Benjamin Dauvergne il y a environ 9 ans

  • Statut changé de Nouveau à Résolu (à déployer)
  • % réalisé changé de 0 à 100
#6

Mis à jour par Benjamin Dauvergne il y a environ 9 ans

  • Version cible mis à 2.1.12
#7

Mis à jour par Benjamin Dauvergne il y a environ 9 ans

  • Statut changé de Résolu (à déployer) à Solution déployée
#8

Mis à jour par Benjamin Dauvergne il y a environ 9 ans

  • Statut changé de Solution déployée à Fermé

Formats disponibles : Atom PDF