I want to have another name on the supervisor web console.

Asked 2 years ago, Updated 2 years ago, 24 views

I am using the supervisor web console.

By default, the /etc/supervisord.conf file set to program is
It will come out as it is, so
Is it possible to use Japanese under another name?
Even if I input the program directly in Japanese, it was impossible because it was translated into characters.

This is the web console
Thank you for your cooperation.

python supervisord

2022-09-30 10:51

1 Answers

The Python 2.x series treats unicode and ascii strings as different objects (objects?) and needed to be modified accordingly.The method described below is symptomatic therapy and is not a fundamental solution.In other words, there is a high possibility that it will be disabled by upgrading the Supervisor.

  • Ubutu Linux 12.04
  • Python 2.7
  • Supervisor 3.0b2 (package installed with apt)

web.py has the following paths:

/usr/share/pyshared/supervisor/web.py

If installed in the user's local directory, it may be located below $HOME/.local, so please find it accordingly.

Here are the patches for the changes:

 --- web.py.org 2013-07-19 12:30:58.000000000+0900
+++ web.py 2015-01-31 14:55:42.482416837+0900
@@ -203,7 +203,7 @@
         root=self.clone()

         title=root.findmeld('title')
-        title.content('Supervisor tail of process%s'%processname)
+        title.content('Supervisor tail of process%s'%processname.decode('utf-8'))
         tailbody=root.findmeld('tailbody')
         tailbody.content(tail)

@@ -426,7 +426,7 @@
         if message is not None:
             statusarea=root.findmeld('statusmessage')
             statusarea.attrib ['class'] = 'status_msg'
-            statusarea.content(message)
+            statusarea.content(message.decode('utf-8'))

         if data:
             iterator=root.findmeld('tr').repeat(data)
@@ -445,7 +445,7 @@
                 processname=make_namespec(item['group'], item['name'])
                 anchor.attributes(href='tail.html?processname=%s'%
                                   urllib.quote(processname))
-                anchor.content(processname)
+                anchor.content(processname.decode('utf-8'))

                 actions=item['actions']
                 actionitem_td = tr_element.findmeld('actionitem_td')

Save this as, for example, supervisor_utf-8.patch and do the following:

$cd [ directory where web.py exists ]
$ cp-pv web.py web.py.org
$ patch<supervisor_utf-8.patch

# If the questioner's environment is not UNIX-based, you will need to manually patch it

Also, I think it would be better to set charset in the template file (HTML) that Supervisor is using in the web console.Below is UTF-8, but please change it accordingly.

Target File:

/usr/share/pyshared/supervisor/ui/status.html
/usr/share/pyshared/supervisor/ui/tail.html

Additional information: (metahttp-equiv=... portion)

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <title>Supervisor Status</title>
              :
</head>

It is also recommended that you set up a locale for programs (processes) that start from Supervisor.The following is ja_JP.UTF-8, but please change it accordingly.

Target File:

/etc/supervisor/supervisor.conf

Additional information: ( environment=... part)

 [supervisord]
environment=LANG='ja_JP.UTF-8', LC_ALL='ja_JP.UTF-8'

After Supervisor UTF-8 patch


2022-09-30 10:51

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.