The problem seems to come from your python path, that is not well defined. Try to define path in an absolute (not realtive) fashion.
import os os.environ['PYTHONPATH'] = '/path/to/myproject' os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings' and then, apache should be able to execute compile messages Greetings, Isaac On Fri, Jan 14, 2011 at 7:48 AM, Akash <akash.mani...@gmail.com> wrote: > Following are the environment I am working on: > 1. Django 1.2.3 > 2. Python 2.4 > 3. wsgi > 4. Centos 5.4 > > From apache, I can run makemessage command, and it works. It creates > the *.po files. > I use the following statement for this. > os.system("django-admin.py makemessages -l hi") > > But I am unable to do compilemessages from apache. Following are the > steps which I tried out: > > os.system("django-admin.py compilemessages") AND > subprocess.Popen(["django-admin.py", "compilemessages"]) > > The command works fine from command line though, when run from project > location. > $django-admin.py compilemessages. > > but when I do python manage.py shell and then try to run it using > os.system, I get the following error: > ........ > File "/usr/lib/python2.4/site-packages/django/core/management/ > commands/compilemessages.py", line 52, in handle > compile_messages(locale) > File "/usr/lib/python2.4/site-packages/django/core/management/ > commands/compilemessages.py", line 10, in compile_messages > basedirs.extend(settings.LOCALE_PATHS) > File "/usr/lib/python2.4/site-packages/django/utils/functional.py", > line 276, in __getattr__ > self._setup() > File "/usr/lib/python2.4/site-packages/django/conf/__init__.py", > line 40, in _setup > self._wrapped = Settings(settings_module) > File "/usr/lib/python2.4/site-packages/django/conf/__init__.py", > 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 > 'igp_distribution_manager.settings' (Is it on sys.path? Does it have > syntax errors?): No module named igp_distribution_manager.settings > 256 > > So I am not sure If I should be using os.system for this, or if there > is another way to run it from apache. > > I am sure I am doing something wrong out here. > If someone have faced this before and have got some solution, then > please guide me to get through it. > > Regards, > Akash > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.