Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Commit

Permalink
settings.py: fix 'imp' deprecation warning
Browse files Browse the repository at this point in the history
This was the warning

```
DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
  import imp
```

Signed-off-by: Charles Oliveira <[email protected]>
  • Loading branch information
chaws committed Apr 24, 2024
1 parent 5b2dec2 commit 44a5013
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions squad/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from celery.schedules import crontab
from django.conf import global_settings
from email.utils import parseaddr
from importlib.util import find_spec
from glob import glob
import contextlib
import json
Expand Down Expand Up @@ -55,30 +56,23 @@

# Application definition

try:
import imp
imp.find_module('django_extensions')
django_extensions = None
if find_spec('django_extensions'):
django_extensions = 'django_extensions'
except ImportError:
django_extensions = None

django_toolbar = None
django_toolbar_middleware = None
try:

django_toolbar_module_spec = find_spec('debug_toolbar')
if django_toolbar_module_spec:
DEBUG_TOOLBAR_CONFIG = {
'JQUERY_URL': '',
'SHOW_COLLAPSED': True,
'SHOW_TOOLBAR_CALLBACK': 'squad.frontend.utils.show_debug_toolbar',
}

import imp
imp.find_module('debug_toolbar')
django_toolbar = 'debug_toolbar'
django_toolbar_middleware = 'debug_toolbar.middleware.DebugToolbarMiddleware'
INTERNAL_IPS = ['127.0.0.1']
except ImportError:
pass


django_allauth_middleware = None
Expand Down Expand Up @@ -445,6 +439,9 @@
# Django's default is 2.5MB, which is a bit low
DATA_UPLOAD_MAX_MEMORY_SIZE = 10485760 # 10MB

# Django requires that this specification is present in settings.py
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'

try:
from squad.local_settings import * # noqa: F401,F403
except ImportError:
Expand Down

0 comments on commit 44a5013

Please sign in to comment.