replace except: pass with suppress() context manager
This commit is contained in:
parent
23694b207b
commit
341c2f98e5
5 changed files with 12 additions and 22 deletions
|
@ -1,3 +1,5 @@
|
|||
from contextlib import suppress
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls import include, url
|
||||
from django.contrib import admin
|
||||
|
@ -15,8 +17,6 @@ urlpatterns = [
|
|||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
try:
|
||||
with suppress(ImportError):
|
||||
import debug_toolbar
|
||||
urlpatterns.insert(0, url(r'^__debug__/', include(debug_toolbar.urls)))
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue