From aaefa46cd7d855fbb3b03914e361e8ed7e2c55a8 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Mon, 8 Aug 2022 11:32:01 +0200 Subject: [PATCH] Remove conditional import in apps.py There's no point importing apps.py if Django is not installed. --- daphne/apps.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/daphne/apps.py b/daphne/apps.py index b876f6e..3a566ea 100644 --- a/daphne/apps.py +++ b/daphne/apps.py @@ -2,19 +2,14 @@ # packages import twisted.internet.reactor (e.g. raven does this). import daphne.server # noqa: F401 -try: - # Allow that Django is not installed. - from django.apps import AppConfig - from django.core import checks +from django.apps import AppConfig +from django.core import checks - from .checks import check_daphne_installed -except ImportError: - pass -else: +from .checks import check_daphne_installed - class DaphneConfig(AppConfig): - name = "daphne" - verbose_name = "Daphne" +class DaphneConfig(AppConfig): + name = "daphne" + verbose_name = "Daphne" - def ready(self): - checks.register(check_daphne_installed, checks.Tags.staticfiles) + def ready(self): + checks.register(check_daphne_installed, checks.Tags.staticfiles)