Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use pathlib for join path instead of os.path.join #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

danialkeimasi
Copy link

@danialkeimasi danialkeimasi commented Mar 4, 2021

After Django 3.0, BASE_DIR in settings.py is generated by pathlib (also in this template):
quote from Django docs:

The settings.py generated by the startproject command now uses pathlib.Path instead of os.path for building filesystem paths.

BASE_DIR = Path(__file__).resolve().parent.parent

The proper way to join path with pathlib is like this:

Build paths inside the project like this: BASE_DIR / 'subdir'.

But it was used the old os.path.join
Also, The pathlib library is included in all versions of python >= 3.4. and django supported this, so there is no compatibility issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant