diff --git a/swh/web/manage.py b/swh/web/manage.py --- a/swh/web/manage.py +++ b/swh/web/manage.py @@ -16,12 +16,13 @@ # in swh/web/urls.py, we pass the nostatic options to runserver # in order to have gzip compression enabled. swh_web_config['serve_assets'] = '--nostatic' in sys.argv - if len(sys.argv) > 1 and sys.argv[1] == 'test': - os.environ.setdefault("DJANGO_SETTINGS_MODULE", - "swh.web.settings.tests") - else: - os.environ.setdefault("DJANGO_SETTINGS_MODULE", - "swh.web.settings.development") + if 'DJANGO_SETTINGS_MODULE' not in os.environ: + if len(sys.argv) > 1 and sys.argv[1] == 'test': + os.environ.setdefault("DJANGO_SETTINGS_MODULE", + "swh.web.settings.tests") + else: + os.environ.setdefault("DJANGO_SETTINGS_MODULE", + "swh.web.settings.development") # import root urls module for swh-web before running the django dev server # in order to ensure it will be automatically reloaded when source files # are modified (as django autoreload feature only works if the modules are @@ -31,7 +32,7 @@ except Exception: pass try: - from django.core.management.commands.runserver import ( + from django.core.management.commands.runserver import ( # noqa: N813 Command as runserver ) from django.core.management import execute_from_command_line