Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#18261 closed Cleanup/optimization (fixed)

Clarify the term "project root directory"

Reported by: schnippi Owned by: Susan Tan
Component: Documentation Version: 1.4
Severity: Normal Keywords: project root, root directory, translation, makemessages, compilemessages
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The documentation at

states that makemessages

should be run from "the root directory of your Django project" or "the root directory of your Django app".

As the Django 1.4 directory structure creates mysite/ and mysite/mysite/, it is unclear, what the project's root directory is. Running django-admin makemessages/compilemessages within mysite/ makes the the Django translation system ignore my translation file. Running the commands in mysite/mysite/ instead does work as expected.

It should be explicitly stated in the tutorial, that mysite/mysite/ is the project's root directory.

Attachments (2)

18261.patch (1.7 KB) - added by Susan Tan 5 years ago.
A small doc patch for tutorial01.txt.
18261.2.patch (1.8 KB) - added by Tim Graham 5 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 Changed 6 years ago by Ramiro Morales

Triage Stage: UnreviewedAccepted

comment:2 Changed 6 years ago by Carl Meyer

I'm not familiar enough with the i18n toolchain to be sure where compilemessages/makemessages should be run, or why it would work in one place but not another, but we should _not_ document that mysite/mysite is the "project root directory". The latter is a confusing term that we should maybe just avoid using; if it should have any meaning, it should mean "the directory with", which would be just mysite/. The inner directory is the "project module", the outer directory could be called the "workspace" or "container" or "project root".

In general, we want people running most command-line stuff in the workspace directory (the one with, because that will set up sys.path correctly for all their imports to work. This may not apply to compilemessages/makemessages though.

comment:3 Changed 5 years ago by Aymeric Augustin

Type: UncategorizedCleanup/optimization

Changed 5 years ago by Susan Tan

Attachment: 18261.patch added

A small doc patch for tutorial01.txt.

comment:4 Changed 5 years ago by Susan Tan

Has patch: set

comment:5 Changed 5 years ago by loic84

FWIW the new default refers to that directory as BASE_DIR.

I wasn't a big fan of the BASE_DIR wording (I prefer PROJECT_ROOT) but now that it's there maybe we should refer to that directory as the "base directory".

Changed 5 years ago by Tim Graham

Attachment: 18261.2.patch added

comment:6 Changed 5 years ago by Tim Graham

Could someone familiar with makemessages confirm where it should be run from? I'd expect "project root" means the directory with but based on what the reporters says, it seems like that directory didn't work for him. I've edited Susan's patch slightly, but it'll need further edits if the existing "project root" reference in translation.txt actually means "project module".

comment:7 Changed 5 years ago by Aymeric Augustin

AFAIK makemessages must be run from a directory that contains a locale/ subdirectory where the translations will be collected. locale/ can be anywhere as long as it's in LOCALE_PATHS.

Django does *not* have a concept of a "project root", no matter how you frame it.

comment:8 Changed 5 years ago by Susan Tan

Owner: changed from nobody to Susan Tan
Status: newassigned

comment:9 Changed 5 years ago by Susan Tan

See PR: Feel free to code review there.

comment:10 Changed 5 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In ef3fddf26e8bfe956a52c2aa678db6637caf7adf:

Fixed #18261 -- Clarified 'project root directory'

comment:11 Changed 5 years ago by Tim Graham <timograham@…>

In 5192dbbf5546eb62e1c24d36d91f270b1a2b5eaf:

[1.5.x] Fixed #18261 -- Clarified 'project root directory'

Backport of ef3fddf26e from master

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