Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#2323 closed defect (fixed)

make-messages.py not working outside of django apps

Reported by: Ahmad Alhashemi Owned by: adrian
Component: Internationalization Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

It seems that the translation module now requires 'settings'. This makes it impossible to run make-messages.py outside of an application. This is waht I got when I ran 'make-messages -u' in django's root directory:

Traceback (most recent call last):
  File "C:\Python24\Lib\site-packages\django\bin\make-messages.py", line 3, in ?
    from django.utils.translation.trans_real import templatize
  File "C:\Python24\lib\site-packages\django\utils\translation\__init__.py", line 3, in ?
    if settings.USE_I18N:
  File "C:\Python24\lib\site-packages\django\conf\__init__.py", line 28, in __getattr__
    self._import_settings()
  File "C:\Python24\lib\site-packages\django\conf\__init__.py", line 53, in _import_settings
    raise EnvironmentError, "Environment variable %s is undefined." % ENVIRONMENT_VARIABLE
EnvironmentError: Environment variable DJANGO_SETTINGS_MODULE is undefined.

I tried changing the import line from this:
from django.utils.translation import templatize

To this:
from django.utils.translation.trans_real import templatize

But it still has to run init.py.

I took the liberty to assign it to adrian becasue he is the one who broke it :)

Change History (2)

comment:1 Changed 9 years ago by Ahmad

Please note that the second line in the traceback show my trial to fix the problem. Everything else is the same as the error you would get from trunk.

comment:2 Changed 9 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(In [3374]) Fixed #2323 -- Made it possible to run make-messages without needing a
DJANGO_SETTINGS_FILE setting.

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