Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#19791 closed Cleanup/optimization (wontfix)


Reported by: pzinovkin Owned by: nobody
Component: Uncategorized Version: master
Severity: Release blocker Keywords: settings
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


Because we already have STATIC_ROOT and MEDIA_ROOT.

Change History (4)

comment:1 Changed 7 years ago by pzinovkin

Easy pickings: set

comment:2 Changed 7 years ago by Russell Keith-Magee

Severity: NormalRelease blocker
Triage Stage: UnreviewedDesign decision needed

This is bikeshedding a bit, but I'm inclined to agree. A _ROOT suffix would be more consistent, and PROJECT_ROOT is the name I've seen used in a number of code examples in the wild.

It's at least worth some discussion before the BASE_DIR name is set in stone.

comment:3 Changed 7 years ago by Aymeric Augustin

Resolution: wontfix
Status: newclosed

The name "PROJECT_ROOT" is inappropriate because it implies that a "Django project" has a significant "root directory". That's wrong and misleading. This name was already proposed and rejected in #16504 for this reason.

Python code needs to be on PYTHONPATH in order to be importable; it doesn't need to be in a specific directory. In contrast, media and static files need to be stored within a root directory. To make this difference clear, we must keep the names "BASE_DIR" and "MEDIA/STATIC_ROOT" as different as possible. "BASE_DIR" doesn't imply anything about the Django project, and you can use a different layout if you wish.

It's a common misconception that the code for a Django project must be inside the project (the best practice is to use virtualenv and friends). This probably explains the large number of projects using PROJECT_ROOT in the wild. By putting a different name in the default settings file, I hope to reduce confusion at least a little.

I'm -1 on anything that contains "PROJECT" and -0 on anything that contains "ROOT". Otherwise I don't really care. You're welcome to start a discussion on the django-developers mailing list if you want to change the name!

comment:4 Changed 7 years ago by Russell Keith-Magee

There's certainly a lot of misconceptions that Django projects need to be all in the same directory; but, by the same token, putting all the project-specific code for the same project in the same directory is hardly a revolutionary idea, and in every project I've ever been involved in, I would be able to point at something that could be meaningfully called the "project root".

However, like I said - bikeshed. I put this as DDN in the off chance that the BASE_DIR name was chosen without any particular consideration for history and existing community usage. That clearly isn't the case.

My preference for _ROOT is based purely on the consistency/implicit documentation argument, but I can't really think of anything other than PROJECT to put in front of _ROOT that would make any sense (especially if you add the 'not drawing attention to the concept of a project' requirement). We've now got a clearly documented explanation for the choice of the BASE_DIR name, so I'm happy to move on.

Note: See TracTickets for help on using tickets.
Back to Top