Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Jan. 14, 2011 12:25:07

A.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

i18n issue with compilemessages


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()

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.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Jan. 15, 2011 13:26:22

Isaac X.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

i18n issue with compilemessages


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 = '/path/to/myproject'
os.environ = '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()
>
> 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 athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 18th of August
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support