How to add new menu between HOME and CREATE EVENT and link to External site

So if indico shell works it’s really odd that everything fails when running indico itself.

Check if systemctl status uwsgi.service shows any errors during startup. If not, add logto = /tmp/uwsgi.log to your uwsgi config file (somewhere in /etc - see the prod setup guide you used for your setup) and restart uwsgi, then check the log file.

PS: Again, please use triple backticks to post terminal output instead of the quote function. It’s much more readable in monospace.

which is triple back tick?

You simply write them :wink:

```
paste here
```

But alternatively you can use the </> button after selecting the text you pasted which does the same in another way

[root@localhost ~]# systemctl status uwsgi.service
● uwsgi.service - uWSGI Emperor Service
   Loaded: loaded (/usr/lib/systemd/system/uwsgi.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/uwsgi.service.d
           └─old-exec-start.conf
   Active: active (running) since Sat 2021-05-01 06:08:50 EDT; 51min ago
 Main PID: 2327 (uwsgi)
   Status: "uWSGI is ready"
   CGroup: /system.slice/uwsgi.service
           ├─2327 indico uWSGI master
           ├─2349 indico uWSGI worker 1
           ├─2351 indico uWSGI worker 2
           ├─2353 indico uWSGI worker 3
           └─2355 indico uWSGI worker 4

May 01 06:42:22 localhost.localdomain uwsgi[2327]: top_menu_items = build_menu_structure('top-menu')
May 01 06:42:22 localhost.localdomain uwsgi[2327]: File "/opt/indico/.venv/lib/python2.7/site-p...re
May 01 06:42:22 localhost.localdomain uwsgi[2327]: for id_, item in named_objects_from_signal(s...):
May 01 06:42:22 localhost.localdomain uwsgi[2327]: File "/opt/indico/.venv/lib/python2.7/site-p...nd
May 01 06:42:22 localhost.localdomain uwsgi[2327]: for receiver in self.receivers_for(sender)]
May 01 06:42:22 localhost.localdomain uwsgi[2327]: File "/opt/indico/.venv/lib/python2.7/site-p...ed
May 01 06:42:22 localhost.localdomain uwsgi[2327]: return func(*args, **kwargs)
May 01 06:42:22 localhost.localdomain uwsgi[2327]: File "/opt/indico/.venv/lib/python2.7/site-p...nu
May 01 06:42:22 localhost.localdomain uwsgi[2327]: return TopMenuItem('my-menu-item', 'Open Sci...5)
May 01 06:42:22 localhost.localdomain uwsgi[2327]: NameError: global name 'TopMenuItem' is not ...ed
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]#

Ah yeah like I said, my code was untested. It’s missing a from indico.web.menu import TopMenuItem line at the top.

However, this should have failed in indico shell as well as long as it’s the same indico instance where the plugin is enabled…

added logto = /tmp/uwsgi.log line to /etc/uwsgi.ini
and got this in the log.

*** Starting uWSGI 2.0.18 (64bit) on [Sat May  1 07:02:24 2021] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-39) on 13 May 2020 17:24:14
os: Linux-3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020
nodename: localhost.localdomain
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 4
current working directory: /
detected binary path: /usr/sbin/uwsgi
setgid() to 48
setuid() to 995
your processes number limit is 14989
your memory page size is 4096 bytes
 *** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers ***
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 127.0.0.1:8008 fd 4
Python version: 2.7.5 (default, Nov 16 2020, 22:23:17)  [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
Set PythonHome to /opt/indico/.venv
Python main interpreter initialized at 0x1a95b60
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 446520 bytes (436 KB) for 4 cores
*** Operational MODE: preforking ***
WSGI app 0 (mountpoint='') ready in 3 seconds on interpreter 0x1a95b60 pid: 10512 (default app)
spawned uWSGI master process (pid: 10512)
spawned uWSGI worker 1 (pid: 10541, cores: 1)
Sat May  1 07:02:27 2021 - mem-collector thread started for worker 1
spawned uWSGI worker 2 (pid: 10543, cores: 1)
Sat May  1 07:02:27 2021 - mem-collector thread started for worker 2
spawned uWSGI worker 3 (pid: 10545, cores: 1)
Sat May  1 07:02:27 2021 - mem-collector thread started for worker 3
spawned uWSGI worker 4 (pid: 10547, cores: 1)
*** Stats server enabled on /opt/indico/web/uwsgi-stats.sock fd: 20 ***
Sat May  1 07:02:27 2021 - mem-collector thread started for worker 4

Added the line and Removed old .whl before installing new wheel and it is done. Thank you so much indeed.

The file doesn’t really matter, it is not used anymore after installing.

But I’d recommend using the --add-version-suffix option when building the wheel; like this you always get a higher version number. Alternatively you can do pip uninstall -y indico-plugin-my-custom-top-menu-link first to make sure the old version of the plugin is no longer there.

exactly that is what I did before installing the new wheel.

I have another quest to add several menu items just above the footer. Should I use similar approach but what would be different? May I open new topic?

I created a configurable plugin
https://github.com/bpedersen2/indico-topmenu-extender to add these top-menu entries.

1 Like

Nice! But I think it’d be nice to use the standard naming pattern that most other indico plugins use as well (in the setup.{py,cfg} name= arg), ie indico-plugin-XXX before publishing it to pypi

No problem, changed. New reponame as well: GitHub - bpedersen2/indico-plugin-topmenuextender: A plugin for INDICO to add custom menu links in the top menu