Skip to content
Snippets Groups Projects
Commit 3659a1f4 authored by Roang's avatar Roang
Browse files

Update package check in dev settings

A complete import of django-debug-toolbar and django_extensions was not
necessary, as we just wanted to check if the package was installed.
With newer versions of python (3.3+), we can use the
`importlib.util.find_spec`` function to check if a package is installed.
parent 201e138e
Branches
Tags
No related merge requests found
......@@ -67,9 +67,7 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# configure debug_toolbar if it is installed and we're not testing
if 'test' not in sys.argv:
try:
import debug_toolbar # noqa: F401
if importlib.util.find_spec('debug_toolbar') is not None:
INSTALLED_APPS += [ # noqa: F405
'debug_toolbar',
]
......@@ -88,9 +86,6 @@ if 'test' not in sys.argv:
INTERNAL_IPS = [
'127.0.0.1',
]
except ImportError:
pass
if importlib.util.find_spec('django_watchfiles') is not None:
INSTALLED_APPS += [ # noqa: F405
'django_watchfiles',
......@@ -99,10 +94,5 @@ if 'test' not in sys.argv:
# configure extensions if they're available
# allows to e.g. generate a PNG of the models' relationships:
# ./manage.py graph_models core -g -o ../models.png --disable-abstract-fields -X ContentType,PermissionsMixin,AbstractBaseUser,Group,Permission
try:
import django_extensions # noqa: F401
if importlib.util.find_spec('django_extensions') is not None:
INSTALLED_APPS = ['django_extensions', *INSTALLED_APPS] # noqa: F405
except ImportError:
pass
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment