From 26554cf5d1e96db10d0d5f4b69683a22fb82fdf8 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Thu, 7 Nov 2019 02:11:27 -0800 Subject: Fixed #29983 -- Replaced os.path() with pathlib.Path in project template and docs. Thanks Curtis Maloney for the original patch. --- docs/howto/overriding-templates.txt | 6 +++--- docs/howto/static-files/index.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'docs/howto') diff --git a/docs/howto/overriding-templates.txt b/docs/howto/overriding-templates.txt index e7c65dd354..eeba350478 100644 --- a/docs/howto/overriding-templates.txt +++ b/docs/howto/overriding-templates.txt @@ -27,9 +27,9 @@ Let's say you're trying to override the templates for a third-party application called ``blog``, which provides the templates ``blog/post.html`` and ``blog/list.html``. The relevant settings for your project would look like:: - import os + from pathlib import Path - BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + BASE_DIR = Path(__file__).resolve(strict=True).parents[1] INSTALLED_APPS = [ ..., @@ -40,7 +40,7 @@ called ``blog``, which provides the templates ``blog/post.html`` and TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [os.path.join(BASE_DIR, 'templates')], + 'DIRS': [BASE_DIR / 'templates'], 'APP_DIRS': True, ... }, diff --git a/docs/howto/static-files/index.txt b/docs/howto/static-files/index.txt index 7b8366e66e..db2b520543 100644 --- a/docs/howto/static-files/index.txt +++ b/docs/howto/static-files/index.txt @@ -52,7 +52,7 @@ you can define a list of directories (:setting:`STATICFILES_DIRS`) in your settings file where Django will also look for static files. For example:: STATICFILES_DIRS = [ - os.path.join(BASE_DIR, "static"), + BASE_DIR / "static", '/var/www/static/', ] -- cgit v1.3