diff --git a/plinth/__main__.py b/plinth/__main__.py index 4ab44f5c0..500250a59 100644 --- a/plinth/__main__.py +++ b/plinth/__main__.py @@ -108,9 +108,6 @@ def main(): if arguments.list_dependencies is not False: log.default_level = 'ERROR' - web_framework.init(read_only=True) - module_loader.include_urls() - menu.init() module_loader.load_modules() module_loader.apps_init() list_dependencies(arguments.list_dependencies) diff --git a/plinth/web_framework.py b/plinth/web_framework.py index 678012688..9fc8b6433 100644 --- a/plinth/web_framework.py +++ b/plinth/web_framework.py @@ -20,7 +20,7 @@ from . import cfg, glib, log, module_loader, settings logger = logging.getLogger(__name__) -def init(read_only=False): +def init(): """Setup Django configuration in the absence of .settings file""" # Workaround for django-simple-captcha 0.5.6 not being compatible with # Django 3.2. 0.5.14 is almost there in Debian. Workaround only until then. @@ -40,7 +40,7 @@ def init(read_only=False): settings.LANGUAGES = get_languages() settings.LOGGING = log.get_configuration() settings.MESSAGE_TAGS = {message_constants.ERROR: 'danger'} - settings.SECRET_KEY = _get_secret_key(read_only) + settings.SECRET_KEY = _get_secret_key() settings.SESSION_FILE_PATH = os.path.join(cfg.data_dir, 'sessions') settings.STATIC_URL = '/'.join([cfg.server_dir, 'static/']).replace('//', '/') @@ -69,7 +69,7 @@ def post_init(): glib.schedule(24 * 3600, _cleanup_expired_sessions, in_thread=True) -def _get_secret_key(read_only=False): +def _get_secret_key(): """Retrieve or create a new Django secret key.""" secret_key_file = pathlib.Path(cfg.data_dir) / 'django-secret.key' if secret_key_file.exists(): @@ -77,9 +77,6 @@ def _get_secret_key(read_only=False): if len(secret_key) >= 128: return secret_key - if read_only: - return '' - secret_key = _generate_secret_key() # File should be created with permission 0o700 old_umask = os.umask(0o077)