Projet

Général

Profil

0001-general-use-a-specific-variable-name-for-local-setti.patch

Frédéric Péters, 15 février 2015 10:44

Télécharger (1,72 ko)

Voir les différences:

Subject: [PATCH] general: use a specific variable name for local settings
 filename (#6515)

 authentic2-ctl         | 14 +-------------
 authentic2/settings.py |  6 ++++--
 2 files changed, 5 insertions(+), 15 deletions(-)
authentic2-ctl
3 3
import sys
4 4

  
5 5
if __name__ == "__main__":
6
    config_file = False
7

  
8
    argv = sys.argv[1:]
9
    if argv and argv[0].startswith('--config='):
10
        config_file = argv[0].split('=')[1]
11
        argv.pop(0)
12

  
13
    if config_file:
14
        os.environ['DJANGO_CONFIG_FILE'] = config_file
15
    elif os.path.exists('./local_settings.py'):
16
        os.environ['DJANGO_CONFIG_FILE'] = './local_settings.py'
17

  
18 6
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "authentic2.settings")
19 7

  
20 8
    from django.core.management import execute_from_command_line
21 9

  
22
    execute_from_command_line(sys.argv[:1] + argv)
10
    execute_from_command_line(sys.argv)
authentic2/settings.py
257 257
# Load configuration file
258 258
#
259 259

  
260
if 'DJANGO_CONFIG_FILE' in os.environ:
261
    execfile(os.environ['DJANGO_CONFIG_FILE'])
260
local_settings_file = os.environ.get('AUTHENTIC_SETTINGS_FILE',
261
        os.path.join(os.path.dirname(__file__), 'local_settings.py'))
262
if os.path.exists(local_settings_file):
263
    execfile(local_settings_file)
262 264

  
263 265
#
264 266
# Apply monkey patches
265
-