Remove conditional import in apps.py

There's no point importing apps.py if Django is not installed.
This commit is contained in:
Carlton Gibson 2022-08-08 11:32:01 +02:00
parent d0f281f133
commit aaefa46cd7

View File

@ -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)