Opened 7 years ago

Closed 7 years ago

#15073 closed (invalid)

django i18n issue

Reported by: rameshsahoo Owned by: nobody
Component: * Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


I am trying to generate an .mo file from a .po file using compilemessages. I am having Django 1.2.3 on Centos 5.4 with mod_wsgi. The issue is when I try to run the command which is os.system(" compilemessages") from my project directory which is "/var/opt/project-name", it throws an error.

Traceback (most recent call last):

File "/usr/lib/python2.4/site-packages/django/bin/", line 5, in ?


File "/usr/lib/python2.4/site-packages/django/core/management/", line 429, in execute_from_command_line


File "/usr/lib/python2.4/site-packages/django/core/management/", line 379, in execute


File "/usr/lib/python2.4/site-packages/django/core/management/", line 191, in run_from_argv

self.execute(*args, options.dict)

File "/usr/lib/python2.4/site-packages/django/core/management/", line 220, in execute

output = self.handle(*args, options)

File "/usr/lib/python2.4/site-packages/django/core/management/commands/", line 52, in handle


File "/usr/lib/python2.4/site-packages/django/core/management/commands/", line 10, in compile_messages


File "/usr/lib/python2.4/site-packages/django/utils/", line 276, in getattr


File "/usr/lib/python2.4/site-packages/django/conf/", line 40, in _setup

self._wrapped = Settings(settings_module)

File "/usr/lib/python2.4/site-packages/django/conf/", line 74, in init

raise ImportError("Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e))

ImportError: Could not import settings 'project.settings' (Is it on sys.path? Does it have syntax errors?): No module named project.settings

The exact steps that I followed is as follows:
(This is from the project directory)
$ python shell

import os
os.system(" compilemessages")

The minute I do enter, it throws this error. I have appended my project path in sys.path still its not working.
My mod_wsgi configuration is:

import os, sys
#sys.path.insert(0, '/var/opt')
sys.path.insert(0, '/var/opt/project')
os.environDJANGO_SETTINGS_MODULE? = 'project.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Change History (1)

comment:1 Changed 7 years ago by Adam Gomaa

Resolution: invalid
Status: newclosed

Setting DJANGO_SETTINGS_MODULE in your mod_wsgi .wsgi file doesn't set it on the command line. There's also no reason to be using os.system(). Also, modifying sys.path in your .wsgi file (or in a shell) won't pass through to os.system().

You want something like:

$ cd /path/to/above/project
$ DJANGO_SETTINGS_MODULE=project.settings compilemessages

If this doesn't do it for you, please ask on django-users:

Or check out the FAQ page for getting help:

This bugtracker is for bugs or features in Django, not for support.

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