diff options
| author | Jon Dufresne <jon.dufresne@gmail.com> | 2019-11-07 02:11:27 -0800 |
|---|---|---|
| committer | Carlton Gibson <carlton.gibson@noumenal.es> | 2019-11-07 11:11:27 +0100 |
| commit | 26554cf5d1e96db10d0d5f4b69683a22fb82fdf8 (patch) | |
| tree | 57c685edd5ce651611e309e539a5eda80cd2f82b /django | |
| parent | 77aa74cb70dd85497dbade6bc0f394aa41e88c94 (diff) | |
Fixed #29983 -- Replaced os.path() with pathlib.Path in project template and docs.
Thanks Curtis Maloney for the original patch.
Diffstat (limited to 'django')
| -rw-r--r-- | django/conf/project_template/project_name/settings.py-tpl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/django/conf/project_template/project_name/settings.py-tpl b/django/conf/project_template/project_name/settings.py-tpl index 7dfe186929..7d230ef0cc 100644 --- a/django/conf/project_template/project_name/settings.py-tpl +++ b/django/conf/project_template/project_name/settings.py-tpl @@ -10,10 +10,10 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/ """ -import os +from pathlib import Path -# Build paths inside the project like this: os.path.join(BASE_DIR, ...) -BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve(strict=True).parents[1] # Quick-start development settings - unsuitable for production @@ -76,7 +76,7 @@ WSGI_APPLICATION = '{{ project_name }}.wsgi.application' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + 'NAME': BASE_DIR / 'db.sqlite3', } } |
