python3: use exec(open(... to replace execfile

This commit is contained in:
Frédéric Péters 2020-01-19 19:04:15 +01:00
parent 490e418460
commit b2a4754975
2 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# This file is sourced by "execfile" from welco.settings
# This file is sourced by "exec(open(..." from welco.settings
import os
@ -10,12 +10,12 @@ INSTALLED_APPS += ('mellon',)
#
# hobotization (multitenant)
#
execfile('/usr/lib/hobo/debian_config_common.py')
exec(open('/usr/lib/hobo/debian_config_common.py').read())
#
# local settings
#
execfile(os.path.join(ETC_DIR, 'settings.py'))
exec(open(os.path.join(ETC_DIR, 'settings.py')).read())
# run additional settings snippets
execfile('/usr/lib/hobo/debian_config_settings_d.py')
exec(open('/usr/lib/hobo/debian_config_settings_d.py').read())

View File

@ -220,4 +220,4 @@ REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES'] = ['rest_framework.authenticati
local_settings_file = os.environ.get('WELCO_SETTINGS_FILE',
os.path.join(os.path.dirname(__file__), 'local_settings.py'))
if os.path.exists(local_settings_file):
execfile(local_settings_file)
exec(open(local_settings_file).read())