Skip to content
Snippets Groups Projects
Commit cede455a authored by Antoine Lambert's avatar Antoine Lambert
Browse files

cli/client: Fix commands execution by ensuring django is initialized

Previously, trying to execute the following commands:

- swh deposit upload ...
- swh deposit status ...
- swh deposit list ...
- swh deposit metadata-only ...

was returning the following error:

Could not load subcommand swh.deposit:
ImproperlyConfigured('Requested setting INSTALLED_APPS, but settings are not
configured. You must either define the environment variable DJANGO_SETTINGS_MODULE
or call settings.configure() before accessing settings.')

So ensure to init django at the beginning of each command to fix their usability.

Also prevent a similar side effect when swh.deposit.cli.client module is imported
by moving the import of swh.deposit.utils.NAMESPACES from top level to the function
it is used, this prevents the error message above to be displayed when using swh
command shell autocompletion feature.
parent f041c3d7
No related branches found
Tags v1.3.4
Loading
Checking pipeline status