Skip to content

Commit ba8f89c

Browse files
renzonrenzon
authored andcommitted
Changed setting to use Pathlib
close #4092
1 parent 008bec9 commit ba8f89c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pythonpro/settings.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010
https://docs.djangoproject.com/en/dev/ref/settings/
1111
"""
1212

13-
import os
1413
from functools import partial
14+
from pathlib import Path
1515

1616
import sentry_sdk
1717
from decouple import Csv, config
1818
from dj_database_url import parse as dburl
1919
from sentry_sdk.integrations.celery import CeleryIntegration
2020
from sentry_sdk.integrations.django import DjangoIntegration
2121

22-
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
23-
22+
# BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
23+
BASE_DIR = Path(__file__).resolve().parent.parent
2424
# SECURITY WARNING: keep the secret key used in production secret!
2525
SECRET_KEY = config('SECRET_KEY')
2626

@@ -161,7 +161,7 @@
161161

162162
# Database
163163
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
164-
default_db_url = 'sqlite:///' + os.path.join(BASE_DIR, 'db.sqlite3')
164+
default_db_url = 'sqlite:///' + str(BASE_DIR / 'db.sqlite3')
165165

166166
if 'localhost' not in ALLOWED_HOSTS:
167167
dburl = partial(dburl, conn_max_age=600, ssl_require=True)
@@ -240,9 +240,9 @@
240240

241241
# Configuration for dev environment
242242
MEDIA_URL = '/media/'
243-
MEDIA_ROOT = os.path.join(BASE_DIR, 'mediafiles')
243+
MEDIA_ROOT = str(BASE_DIR / 'mediafiles')
244244
STATIC_URL = '/static/'
245-
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
245+
STATIC_ROOT = str(BASE_DIR / 'staticfiles')
246246
COLLECTFAST_ENABLED = False
247247

248248
# STORAGE CONFIGURATION IN S3 AWS

0 commit comments

Comments
 (0)