Opened 13 years ago

Closed 11 years ago

Last modified 11 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

Description

The documentation at

https://docs.djangoproject.com/en/dev/topics/i18n/translation/#message-files

states that

django-admin.py 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 11 years ago.
A small doc patch for tutorial01.txt.
18261.2.patch (1.8 KB ) - added by Tim Graham 11 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 by Ramiro Morales, 13 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Carl Meyer, 13 years ago

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 manage.py", 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 manage.py), because that will set up sys.path correctly for all their imports to work. This may not apply to compilemessages/makemessages though.

comment:3 by Aymeric Augustin, 12 years ago

Type: UncategorizedCleanup/optimization

by Susan Tan, 11 years ago

Attachment: 18261.patch added

A small doc patch for tutorial01.txt.

comment:4 by Susan Tan, 11 years ago

Has patch: set

comment:5 by loic84, 11 years ago

FWIW the new default settings.py 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".

by Tim Graham, 11 years ago

Attachment: 18261.2.patch added

comment:6 by Tim Graham, 11 years ago

Could someone familiar with makemessages confirm where it should be run from? I'd expect "project root" means the directory with manage.py 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 by Aymeric Augustin, 11 years ago

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 by Susan Tan, 11 years ago

Owner: changed from nobody to Susan Tan
Status: newassigned

comment:9 by Susan Tan, 11 years ago

See PR: https://github.com/django/django/pull/1340/ Feel free to code review there.

comment:10 by Tim Graham <timograham@…>, 11 years ago

Resolution: fixed
Status: assignedclosed

In ef3fddf26e8bfe956a52c2aa678db6637caf7adf:

Fixed #18261 -- Clarified 'project root directory'

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

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