Django and Gettext on Cpanel
This question was asked by one of our users. Cpanel v90.0.14, Cloudlinux 7.8 on Centos 7.
User configures and installs his project on Django according to the instructions: django-admin and manage.py | Django documentation | Django
In place, after the "django-admin compilemessages" command, it gets a CommandError: Can't find msgfmt. Make sure you have GNU gettext tools 0.15 or newer installed. Python-gettext already installed:
python-gettext 4.0.
Non-root user does not access to the /usr/bin/gettext library and cannot use it. What can you suggest to run "django-admin compilemessages" (this is needed for translations and site localization) and how can he use the gettext library?
Gettext itself is in /usr/bin:
root:
[root ~]# gettext --version
gettext (GNU gettext-runtime) 0.19.8.1
[root ~]# which gettext
/usr/bin/gettext
User:
gettext --version
bash: gettext: command not found
[user ~]$ /usr/bin/gettext --version
bash: /usr/bin/gettext: No such file or directory
[user ~]$ which gettext
/usr/bin/which: no gettext in (/usr/local/cpanel/3rdparty/lib/path-bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/cpanel/composer/bin:/root/bin:/opt/cpanel/composer/bin)
-
Hello @Denis.v ! Based on previous instances of this, by default the user should be able to access gettext as it is only in /usr/bin/gettext
. However, I believe I have encountered this before. Do you know if the cPanel user in this question has CageFS Enabled? I went ahead and tested this, and when adding a cPanel user to CageFS that user no longer had access to/usr/bin/
. What you would need to do is either remove the user from CageFS, or alternatively you can edit the file/etc/cagefs/cagefs.mp
and add the value:/usr/bin
. Please note, when you add a new directory to CageFS, you must remount remount the CageFS skeleton directory and all of the enabled users. Which is done using this command:cagefsctl -M
I hope this helps!0 -
Added. Yes, now: [user] $ gettext --version gettext (GNU gettext-runtime) 0.19.8.1. I don't know how much this will affect security, but there is access. Thank you! 0 -
My pleasure! I believe another option is that you can edit /etc/cagefs/cagefs.mp
again but add just the binary for/usr/bin/gettext
. Regardless, I do believe this should work for you. I am glad that we could help and for now you are able to use gettext!0
Please sign in to leave a comment.
Comments
3 comments