On Jun 9, 2020, at 11:04 AM, Mark Sapiro <mark@msapiro.net> wrote:
The
django-admin
command that is being run doesn't itself point to your settings. In my case, I run django-admin via a wrapper that contains#!/bin/bash . /opt/mailman/mm/venv/bin/activate cd /opt/mailman/mm export PYTHONPATH=/opt/mailman/mm export DJANGO_SETTINGS_MODULE=settings django-admin $@
The critical things are the exports of PYTHONPATH and DJANGO_SETTINGS_MODULE. The former is the path to where your settings module lives and the latter is its name without the .py extension.
OK, making progress:
mark@mail:/usr/local/bin$ !! ./mm3-admin shell Python 3.8.2 (default, Apr 27 2020, 15:53:34) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole)
from hyperkitty.models import Email emails = Email.objects.all() for email in emails: ... if email.content.find('\u200b'*5) >= 0: ... print('Found in ml {}, hash {}'.format( ... email.mailinglist.name, ... email.message_id_hash)) ... ./mm3-admin: line 6: 702058 Killed django-admin $@
Now what?
- Mark
mark@pdc-racing.net | 408-348-2878