Notice: In order to edit this ticket you need to be either: a Product Owner, The owner or the reporter of the ticket, or, in case of a Task not yet assigned, a team_member"

Task #8164 (closed)

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

Django custom app settings loader

Reported by: atarkowska Owned by: wmoore
Priority: major Milestone: OMERO-4.4.4
Component: Web Version: n.a.
Keywords: n.a. Cc: web-team@…
Resources: n.a. Referenced By: n.a.
References: n.a. Remaining Time: n.a.
Sprint: 2012-08-14 (2)

Description

In addition to #8022 there is a potential need for having additional app specific settings in the additional applications. This could be resolved by the adding to the INSTALL_APP validator code like, where we basically check if any additional apps have own settings and then load them automaticly. This require extra documentation to make sure developer does not override core settings. Suggestion was to request prefix on each custom settings like:

emdb/settings.py

EMDB_VAR1 = True
EMDB_VAR2 = False

Change History (11)

comment:1 Changed 7 years ago by atarkowska

  • Owner atarkowska deleted

comment:2 Changed 7 years ago by wmoore

  • Milestone changed from OMERO-Beta4.4 to OMERO-Beta4.4.1
  • Owner set to cxallan

Chris - you wanna have a look at this? Not for 4.4 though.

comment:3 Changed 7 years ago by wmoore

  • Owner changed from cxallan to wmoore
  • Sprint set to 2012-07-31 (1)

A similar use case: I want to be able to add an app, and have it's RIGHT_PLUGINS and CENTER_PLUGINS Added to the existing webclient ones.

In the example above, would

emdb.settings.EMDB_VAR1 = True 

result in

omeroweb.settings.VAR1 = True

?

Maybe easier to do

emdb/settings.py

CUSTOM_SETTINGS_MAPPINGS = {
    'RIGHT_PLUGINS': ['[a, b, c]', add],
    'CENTER_PLUGINS': ['[a, b, c]', overwrite],
}

comment:4 Changed 7 years ago by wmoore

  • Status changed from new to accepted

comment:5 Changed 7 years ago by wmoore

This reads in settings from additional apps. In the case of the setting being a list (E.g. plugins) it appends the app's settings to the default settings. Needs more discussion. See

https://github.com/will-moore/openmicroscopy/commit/6a3e9330ecc662e6a1f4275b7ecd4f44f5959688

comment:6 Changed 7 years ago by wmoore

  • Owner wmoore deleted
  • Status changed from accepted to new

comment:7 Changed 7 years ago by wmoore

  • Owner set to wmoore

comment:8 Changed 7 years ago by cxallan

  • Sprint changed from 2012-07-31 (1) to 2012-08-14 (2)

Moved from sprint 2012-07-31 (1)

comment:10 Changed 7 years ago by wmoore

  • Resolution set to fixed
  • Status changed from new to closed

After discussion with Chris yesterday, have simplified parsing of additional apps settings. Simply import <APP>.settings. The <APP>.settings.py code can directly manipulate any settings.
https://github.com/will-moore/openmicroscopy/commit/440d3ebb792c5b0be46e61a4aa61261587db3298

An example of <APP>.settings
https://github.com/will-moore/weblabs/blob/master/settings.py

comment:11 Changed 7 years ago by Will Moore <will@…>

(In [f7c92f03bf7258462aca8b84c2bc8eb3f92d702e/ome.git] on branch develop) Load custom settings from ADDITIONAL_APPS. See #8164

Need to discuss if we want these to override the defaults in omeroweb.settings.py and/or the
defaults set by bin/omero config set

Note: See TracTickets for help on using tickets. You may also have a look at Agilo extensions to the ticket.

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.84329 sec.)

We're Hiring!